pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/haskell/text/commit/d82559453fd3732136d5a3b47b08f38bf191ed71

r-b69241e157469407.css" /> scripts: Add unicodeVersion to generated file · haskell/text@d825594 · GitHub
Skip to content

Commit d825594

Browse files
LysxiaBodigrim
authored andcommitted
scripts: Add unicodeVersion to generated file
1 parent ee33ee2 commit d825594

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scripts/CaseMapping.hs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Data.List (stripPrefix)
2+
import Data.Maybe (fromJust)
13
import System.Environment
24
import System.IO
35

@@ -21,6 +23,7 @@ main = do
2123
h <- openFile oname WriteMode
2224
let comments = map ("--" ++) $
2325
take 2 (cfComments cfs) ++ take 2 (scComments scs)
26+
version = parseVersion (cfComments cfs)
2427
mapM_ (hPutStrLn h) $
2528
["-- AUTOMATICALLY GENERATED - DO NOT EDIT"
2629
,"-- Generated by scripts/CaseMapping.hs"] ++
@@ -31,6 +34,9 @@ main = do
3134
,"module Data.Text.Internal.Fusion.CaseMapping where"
3235
,"import GHC.Int"
3336
,"import GHC.Exts"
37+
,"import Data.Version (Version, makeVersion)"
38+
,"unicodeVersion :: Version"
39+
,"unicodeVersion = makeVersion " ++ version
3440
,"unI64 :: Int64 -> _ {- unboxed Int64 -}"
3541
,"unI64 (I64# n) = n"
3642
,""]
@@ -39,3 +45,14 @@ main = do
3945
mapM_ (hPutStrLn h) (mapSC "title" title toTitle scs)
4046
mapM_ (hPutStrLn h) (mapCF cfs)
4147
hClose h
48+
49+
-- Parse version from CaseFolding comments
50+
-- and render it as a list (an argument of makeVersion)
51+
parseVersion :: [String] -> String
52+
parseVersion comments = fromJust $ do
53+
line' : _ <- pure comments
54+
line'' <- stripPrefix " CaseFolding-" line'
55+
let (v1, line1) = span isDigit line''
56+
(v2, line2) = span isDigit (drop 1 line1)
57+
(v3, _) = span isDigit (drop 1 line2)
58+
pure $ "[" ++ v1 ++ ", " ++ v2 ++ ", " ++ v3 ++ "]"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy