on master help sign in
Add back `dehyphenate` equivalent
8fe02e0Evan Czaplicki
src/Elm/Compiler/Module.hs+8
@@ -10,6 +10,7 @@ module Elm.Compiler.Module
10 , nameToString
10 , nameToString
11 , nameToSlashPath
11 , nameToSlashPath
12 , nameToHyphenPath
12 , nameToHyphenPath
13+ , fromHyphenPath
13 , encode
14 , encode
14 , decoder
15 , decoder
15
16
@@ -53,6 +54,13 @@ nameToHyphenPath name =
53 Text.unpack (Text.replace "." "-" (N.toText name))
54 Text.unpack (Text.replace "." "-" (N.toText name))
54
55
55
56
57+fromHyphenPath :: Text.Text -> Maybe Raw
58+fromHyphenPath txt =
59+ if all isGoodChunk (Text.splitOn "-" txt)
60+ then Just (N.fromText (Text.replace "-" "." txt))
61+ else Nothing
62+
63+
56
64
57-- JSON
65-- JSON
58
66