1{-# LANGUAGE OverloadedStrings #-}
13 , basics, char, string
14 , maybe, result, list, array, dict, tuple
18 , jsonDecode, jsonEncode
19 , webgl, texture, vector2, vector3, vector4, matrix4
24import Control.Monad (liftM2)
25import Data.Binary (Binary(..))
26import qualified Data.Char as Char
27import qualified Data.Name as Name
28import qualified Data.Utf8 as Utf8
29import Prelude hiding (maybe)
30import qualified System.FilePath as FP
32import qualified Elm.Package as Pkg
33import qualified Json.Decode as Decode
34import qualified Json.Encode as Encode
44toChars :: Raw -> String
49toString :: Raw -> Utf8.String
54toFilePath :: Raw -> FilePath
56 map (\c -> if c == '.' then FP.pathSeparator else c) (Name.toChars name)
59toHyphenPath :: Raw -> FilePath
61 map (\c -> if c == '.' then '-' else c) (Name.toChars name)
64fromHyphenPath :: Utf8.String -> Maybe Raw
68 Utf8.split 0x2D {- - -} str
70 if all isGoodChunk chunks
71 then Just (Name.fromUtf8 (Utf8.join 0x2E {- . -} chunks))
79encode :: Raw -> Encode.Value
84decoder :: Decode.Decoder Utf8.String Raw
86 do str <- Decode.string
87 if all isGoodChunk (Utf8.split 0x2E {- . -} str)
88 then return (Name.fromUtf8 str)
89 else Decode.failure str
92isGoodChunk :: Utf8.String -> Bool
94 Utf8.startsWithChar Char.isUpper chunk
95 && Utf8.all (\c -> Char.isAlphaNum c || c == '_') chunk
104 { _package :: !Pkg.Name
105 , _module :: !Name.Name
110canonicalIsKernel :: Canonical -> Bool
111canonicalIsKernel (Canonical _ name) =
119instance Eq Canonical where
120 (==) (Canonical pkg1 name1) (Canonical pkg2 name2) =
121 name1 == name2 && pkg1 == pkg2
124instance Binary Canonical where
125 put (Canonical a b) = put a >> put b
126 get = liftM2 Canonical get get
133{-# NOINLINE basics #-}
135basics = Canonical Pkg.core Name.basics
140char = Canonical Pkg.core Name.char
143{-# NOINLINE string #-}
145string = Canonical Pkg.core Name.string
148{-# NOINLINE maybe #-}
150maybe = Canonical Pkg.core Name.maybe
153{-# NOINLINE result #-}
155result = Canonical Pkg.core Name.result
160list = Canonical Pkg.core Name.list
163{-# NOINLINE array #-}
165array = Canonical Pkg.core Name.array
170dict = Canonical Pkg.core Name.dict
173{-# NOINLINE tuple #-}
175tuple = Canonical Pkg.core Name.tuple
178{-# NOINLINE platform #-}
180platform = Canonical Pkg.core Name.platform
185cmd = Canonical Pkg.core "Platform.Cmd"
190sub = Canonical Pkg.core "Platform.Sub"
193{-# NOINLINE debug #-}
195debug = Canonical Pkg.core Name.debug
198{-# NOINLINE bitwise #-}
200bitwise = Canonical Pkg.core Name.bitwise
207{-# NOINLINE virtualDom #-}
208virtualDom :: Canonical
209virtualDom = Canonical Pkg.virtualDom Name.virtualDom
216{-# NOINLINE jsonDecode #-}
217jsonDecode :: Canonical
218jsonDecode = Canonical Pkg.json "Json.Decode"
221{-# NOINLINE jsonEncode #-}
222jsonEncode :: Canonical
223jsonEncode = Canonical Pkg.json "Json.Encode"
230{-# NOINLINE webgl #-}
232webgl = Canonical Pkg.webgl "WebGL"
235{-# NOINLINE texture #-}
237texture = Canonical Pkg.webgl "WebGL.Texture"
240{-# NOINLINE vector2 #-}
242vector2 = Canonical Pkg.linearAlgebra "Math.Vector2"
245{-# NOINLINE vector3 #-}
247vector3 = Canonical Pkg.linearAlgebra "Math.Vector3"
250{-# NOINLINE vector4 #-}
252vector4 = Canonical Pkg.linearAlgebra "Math.Vector4"
255{-# NOINLINE matrix4 #-}
257matrix4 = Canonical Pkg.linearAlgebra "Math.Matrix4"
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