-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unicode-data: Add new internal module
Unicode.Internal.Char.Version
Everything generated by `ucd2haskell` should be in internal modules. This commit will prevent breaking the update of `Unicode.Char.unicodeVersion`, as it is will be a mere re-export of `Unicode.Internal.Char.Version`.
- Loading branch information
Showing
8 changed files
with
85 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-- | | ||
-- Copyright : (c) 2024 Pierre Le Marre | ||
-- License : Apache-2.0 | ||
-- Maintainer : [email protected] | ||
-- Stability : experimental | ||
-- | ||
-- Unicode version module | ||
module UCD2Haskell.Modules.Version | ||
( writeModule | ||
) where | ||
|
||
import qualified Data.ByteString as B | ||
import qualified Data.ByteString.Builder as BB | ||
import qualified Data.ByteString.Short as BS | ||
import Data.Version (Version, showVersion, versionBranch) | ||
import System.Directory (createDirectoryIfMissing) | ||
import System.FilePath ((</>), (<.>)) | ||
|
||
import UCD2Haskell.Generator (moduleToFileName, unlinesBB, apacheLicense, dirFromFileName) | ||
|
||
writeModule :: | ||
Version -> | ||
FilePath -> | ||
String -> | ||
BS.ShortByteString -> | ||
IO () | ||
writeModule version outDir moduleName since = do | ||
let outFile = outDir </> moduleToFileName moduleName <.> "hs" | ||
let outFileDir = dirFromFileName outFile | ||
createDirectoryIfMissing True outFileDir | ||
B.writeFile outFile . B.toStrict . BB.toLazyByteString . unlinesBB $ | ||
[ "-- DO NOT EDIT MANUALLY: autogenerated by ucd2haskell" | ||
, "{-# OPTIONS_HADDOCK hide #-}" | ||
, "" | ||
, apacheLicense 2024 (BB.string7 moduleName) | ||
, "module " <> BB.string7 moduleName <> " (unicodeVersion) where" | ||
, "" | ||
, "import Data.Version (Version, makeVersion)" | ||
, "" | ||
, "-- | Version of the Unicode standard used by this package:" | ||
, mconcat | ||
[ "-- [" | ||
, BB.string7 (showVersion version) | ||
, "](https://www.unicode.org/versions/Unicode" | ||
, BB.string7 (showVersion version) | ||
, "/)." ] | ||
, "--" | ||
, "-- @since " <> BB.shortByteString since | ||
, "unicodeVersion :: Version" | ||
, "unicodeVersion = makeVersion " | ||
<> BB.string7 (show (versionBranch version)) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- DO NOT EDIT MANUALLY: autogenerated by ucd2haskell | ||
{-# OPTIONS_HADDOCK hide #-} | ||
|
||
-- | | ||
-- Module : Unicode.Internal.Char.Version | ||
-- Copyright : (c) 2024 Composewell Technologies and Contributors | ||
-- License : Apache-2.0 | ||
-- Maintainer : [email protected] | ||
-- Stability : experimental | ||
|
||
module Unicode.Internal.Char.Version (unicodeVersion) where | ||
|
||
import Data.Version (Version, makeVersion) | ||
|
||
-- | Version of the Unicode standard used by this package: | ||
-- [15.0.0](https://www.unicode.org/versions/Unicode15.0.0/). | ||
-- | ||
-- @since 0.3.0 | ||
unicodeVersion :: Version | ||
unicodeVersion = makeVersion [15,0,0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters