Skip to content

Don't enforce compatibility with base #128

Description

@adithyaov

Being compatible with base is NOT required. This is not the responsibility of
the library. Enforcing compatibility also gives an incorrect idea on the
dependency graph. We use functions in base, not the unicode primitives. Hence
it would be incorrect to constraint base depending on the unicode version.

The best case solution is to let base depend unicode-data and
friends. Although, this is not a straightforward task.

The compatibility with the base primitives is a domain specific problem. The
overhead of the check should be pushed to the user. The user may choose to force
compatibility depending on how unicode is being used. The following snippet
checks for compatibility and fails accordingly:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}

import qualified Unicode.Char as UnicodeData (unicodeVersion)
import qualified GHC.Unicode as Base (unicodeVersion)

unicodeCompatibility :: ()
unicodeCompatibility =
    $(if Base.unicodeVersion == UnicodeData.unicodeVersion
      then [|()|]
      else error $ "Incompatible unicode versions: "
                ++ "base: " ++ show Base.unicodeVersion ++ " "
                ++ "unicode-data: " ++ show UnicodeData.unicodeVersion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions