Add back `dehyphenate` equivalent
commit8fe02e0eddbed0c3d7dd7c294cca43a7c4506756
authorEvan Czaplicki <evancz@users.noreply.github.com>
dateTue 30 Jan 2018, 17:53 (9 years ago)
parent64f3f0a
src/Elm/Compiler/Module.hs+8
@@ -10,6 +10,7 @@ module Elm.Compiler.Module
1010 , nameToString
1111 , nameToSlashPath
1212 , nameToHyphenPath
13+ , fromHyphenPath
1314 , encode
1415 , decoder
1516
@@ -53,6 +54,13 @@ nameToHyphenPath name =
5354 Text.unpack (Text.replace "." "-" (N.toText name))
5455
5556
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+
5664
5765-- JSON
5866