1{-# LANGUAGE OverloadedStrings #-}
12 , basics, char, string
13 , maybe, result, list, array, dict, tuple
17 , jsonDecode, jsonEncode
18 , webgl, texture, vector2, vector3, vector4, matrix4
23import Control.Monad (liftM2)
24import Data.Binary (Binary(..))
25import qualified Data.Char as Char
26import qualified Data.Name as Name
27import qualified Data.Utf8 as Utf8
28import Prelude hiding (maybe)
29import qualified System.FilePath as FP
31import qualified Elm.Package as Pkg
32import qualified Json.Decode as Decode
33import qualified Json.Encode as Encode
43toChars :: Raw -> String
48toString :: Raw -> Utf8.String
53toFilePath :: Raw -> FilePath
55 map (\c -> if c == '.' then FP.pathSeparator else c) (Name.toChars name)
58toHyphenPath :: Raw -> FilePath
60 map (\c -> if c == '.' then '-' else c) (Name.toChars name)
63fromHyphenPath :: Utf8.String -> Maybe Raw
67 Utf8.split 0x2D {- - -} str
69 if all isGoodChunk chunks
70 then Just (Name.fromUtf8 (Utf8.join 0x2E {- . -} chunks))
78encode :: Raw -> Encode.Value
83decoder :: Decode.Decoder Utf8.String Raw
85 do str <- Decode.string
86 if all isGoodChunk (Utf8.split 0x2E {- . -} str)
87 then return (Name.fromUtf8 str)
88 else Decode.failure str
91isGoodChunk :: Utf8.String -> Bool
93 Utf8.startsWithChar Char.isUpper chunk
94 && Utf8.all (\c -> Char.isAlphaNum c || c == '_') chunk
103 { _package :: !Pkg.Name
104 , _module :: !Name.Name
111instance Eq Canonical where
112 (==) (Canonical pkg1 name1) (Canonical pkg2 name2) =
113 name1 == name2 && pkg1 == pkg2
116instance Ord Canonical where
117 compare (Canonical pkg1 name1) (Canonical pkg2 name2) =
118 case compare name1 name2 of
120 EQ -> compare 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