1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Elm.Compiler.Module
20 , ModuleName.Canonical(..)
25import qualified Data.Char as Char
26import qualified Data.List as List
27import qualified Data.Text as Text
28import System.FilePath ((</>))
30import qualified AST.Module.Name as ModuleName
31import qualified Elm.Interface as I
32import qualified Elm.Name as N
33import qualified Json.Decode as Decode
34import qualified Json.Encode as Encode
44nameToPath :: Raw -> FilePath
46 List.foldl1 (</>) (map Text.unpack (Text.splitOn "." name))
49nameToString :: Raw -> String
54nameFromText :: Text.Text -> Maybe Raw
59hyphenate :: Raw -> Text.Text
61 Text.replace "." "-" name
64dehyphenate :: Text.Text -> Maybe Raw
69fromText :: Char -> Text.Text -> Maybe Raw
73 Text.splitOn (Text.singleton sep) name
75 if all isGoodChunk chunks then Just name else Nothing
78isGoodChunk :: Text.Text -> Bool
80 case Text.uncons chunk of
85 Char.isUpper first && Text.all isGoodChar rest
88isGoodChar :: Char -> Bool
90 Char.isAlphaNum char || char == '_'
97encode :: Raw -> Encode.Value
102data Error = BadModuleName
105decoder :: Decode.Decoder Error Raw
107 do txt <- Decode.text
108 case nameFromText txt of
110 Decode.fail BadModuleName
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