1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Elm.Compiler.Module
18 , ModuleName.Canonical(..)
23import qualified Data.Char as Char
24import qualified Data.List as List
25import qualified Data.Text as Text
26import System.FilePath ((</>))
28import qualified AST.Module.Name as ModuleName
29import qualified Elm.Interface as I
30import qualified Elm.Name as N
31import qualified Json.Decode as Decode
32import qualified Json.Encode as Encode
42nameToString :: Raw -> String
47nameToSlashPath :: Raw -> FilePath
49 List.foldl1 (</>) (map Text.unpack (Text.splitOn "." (N.toText name)))
52nameToHyphenPath :: Raw -> FilePath
53nameToHyphenPath name =
54 Text.unpack (Text.replace "." "-" (N.toText name))
57fromHyphenPath :: Text.Text -> Maybe Raw
59 if all isGoodChunk (Text.splitOn "-" txt)
60 then Just (N.fromText (Text.replace "-" "." txt))
68encode :: Raw -> Encode.Value
73decoder :: Decode.Decoder Text.Text Raw
76 let chunks = Text.splitOn "." txt
77 if all isGoodChunk chunks
78 then Decode.succeed (N.fromText txt)
82isGoodChunk :: Text.Text -> Bool
84 case Text.uncons chunk of
89 Char.isUpper first && Text.all isGoodChar rest
92isGoodChar :: Char -> Bool
94 Char.isAlphaNum char || char == '_'
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list