1module Elm.Compiler.Module
2 ( Interface, Name(Name)
3 , nameToPath, nameToString, nameFromString
7import Control.Monad (mzero)
8import qualified Data.Aeson as Json
9import qualified Data.Char as Char
10import qualified Data.List as List
11import qualified Data.Text as Text
12import System.FilePath ((</>))
13import qualified AST.Module as Module
16type Interface = Module.Interface
18newtype Name = Name [String]
22nameToPath :: Name -> FilePath
23nameToPath (Name names) =
24 List.foldl1 (</>) names
27nameToString :: Name -> String
28nameToString (Name names) =
29 List.intercalate "." names
32nameFromString :: String -> Maybe Name
34 Name `fmap` mapM isLegit names
37 filter (/= ".") (List.groupBy (\a b -> a /= '.' && b /= '.') raw)
43 if Char.isUpper char && all legitChar rest
48 Char.isAlphaNum char || char `elem` "_'"
51instance Json.ToJSON Name where
53 Json.toJSON (nameToString name)
56instance Json.FromJSON Name where
57 parseJSON (Json.String text) =
58 let rawName = Text.unpack text in
59 case nameFromString rawName of
60 Nothing -> fail (rawName ++ " is not a valid module name")
61 Just name -> return name
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