1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Elm.Compiler.Module
7 , interfaceAliasedTypes
20 , ModuleName.Canonical(..)
24import qualified Data.Char as Char
25import qualified Data.List as List
26import qualified Data.Map as Map
27import qualified Data.Text as Text
28import System.FilePath ((</>))
30import qualified AST.Module.Name as ModuleName
31import qualified Elm.Compiler.Type as Type
32import qualified Elm.Compiler.Type.Extract as Extract
33import qualified Elm.Interface as I
34import qualified Elm.Name as N
35import qualified Json.Decode as Decode
36import qualified Json.Encode as Encode
43interfaceAliasedTypes :: I.Interface -> Map.Map N.Name Type.Type
44interfaceAliasedTypes interface =
45 Map.map Extract.fromAnnotation (I._types interface)
55nameToPath :: Raw -> FilePath
57 List.foldl1 (</>) (map Text.unpack (Text.splitOn "." name))
60nameToString :: Raw -> String
65nameFromText :: Text.Text -> Maybe Raw
70hyphenate :: Raw -> Text.Text
72 Text.replace "." "-" name
75dehyphenate :: Text.Text -> Maybe Raw
80fromText :: Char -> Text.Text -> Maybe Raw
84 Text.splitOn (Text.singleton sep) name
86 if all isGoodChunk chunks then Just name else Nothing
89isGoodChunk :: Text.Text -> Bool
91 case Text.uncons chunk of
96 Char.isUpper first && Text.all isGoodChar rest
99isGoodChar :: Char -> Bool
101 Char.isAlphaNum char || char == '_'
108encode :: Raw -> Encode.Value
113decoder :: Decode.Decoder Raw
115 do txt <- Decode.text
116 case nameFromText txt of
118 Decode.fail "Expecting a module name like \"Html.Events\""
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