1{-# LANGUAGE BangPatterns, OverloadedStrings, UnboxedTuples #-}
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 Data.Word (Word8)
29import Foreign.Ptr (Ptr, plusPtr, minusPtr)
30import Prelude hiding (maybe)
31import qualified System.FilePath as FP
33import qualified Elm.Package as Pkg
34import qualified Json.Decode as D
35import qualified Json.Encode as E
36import qualified Parse.Variable as Var
37import qualified Parse.Primitives as P
38import Parse.Primitives (Row, Col)
48toChars :: Raw -> 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)
67encode :: Raw -> E.Value
72decoder :: D.Decoder (Row, Col) Raw
74 D.customString parser (,)
81parser :: P.Parser (Row, Col) Raw
83 P.Parser $ \(P.State src pos end indent row col) cok _ cerr eerr ->
85 (# isGood, newPos, newCol #) = chompStart pos end col
87 if isGood && minusPtr newPos pos < 256 then
88 let !newState = P.State src newPos end indent row newCol in
89 cok (Utf8.fromPtr pos newPos) newState
91 else if col == newCol then
98chompStart :: Ptr Word8 -> Ptr Word8 -> Col -> (# Bool, Ptr Word8, Col #)
99chompStart pos end col =
101 !width = Var.getUpperWidth pos end
104 (# False, pos, col #)
106 chompInner (plusPtr pos width) end (col + 1)
109chompInner :: Ptr Word8 -> Ptr Word8 -> Col -> (# Bool, Ptr Word8, Col #)
110chompInner pos end col =
115 !word = P.unsafeIndex pos
116 !width = Var.getInnerWidthHelp pos end word
119 if word == 0x2E {-.-} then
120 chompStart (plusPtr pos 1) end (col + 1)
124 chompInner (plusPtr pos width) end (col + 1)
133 { _package :: !Pkg.Name
134 , _module :: !Name.Name
142instance Eq Canonical where
143 (==) (Canonical pkg1 name1) (Canonical pkg2 name2) =
144 name1 == name2 && pkg1 == pkg2
147instance Ord Canonical where
148 compare (Canonical pkg1 name1) (Canonical pkg2 name2) =
149 case compare name1 name2 of
151 EQ -> compare pkg1 pkg2
155instance Binary Canonical where
156 put (Canonical a b) = put a >> put b
157 get = liftM2 Canonical get get
164{-# NOINLINE basics #-}
166basics = Canonical Pkg.core Name.basics
171char = Canonical Pkg.core Name.char
174{-# NOINLINE string #-}
176string = Canonical Pkg.core Name.string
179{-# NOINLINE maybe #-}
181maybe = Canonical Pkg.core Name.maybe
184{-# NOINLINE result #-}
186result = Canonical Pkg.core Name.result
191list = Canonical Pkg.core Name.list
194{-# NOINLINE array #-}
196array = Canonical Pkg.core Name.array
201dict = Canonical Pkg.core Name.dict
204{-# NOINLINE tuple #-}
206tuple = Canonical Pkg.core Name.tuple
209{-# NOINLINE platform #-}
211platform = Canonical Pkg.core Name.platform
216cmd = Canonical Pkg.core "Platform.Cmd"
221sub = Canonical Pkg.core "Platform.Sub"
224{-# NOINLINE debug #-}
226debug = Canonical Pkg.core Name.debug
229{-# NOINLINE bitwise #-}
231bitwise = Canonical Pkg.core Name.bitwise
238{-# NOINLINE virtualDom #-}
239virtualDom :: Canonical
240virtualDom = Canonical Pkg.virtualDom Name.virtualDom
247{-# NOINLINE jsonDecode #-}
248jsonDecode :: Canonical
249jsonDecode = Canonical Pkg.json "Json.Decode"
252{-# NOINLINE jsonEncode #-}
253jsonEncode :: Canonical
254jsonEncode = Canonical Pkg.json "Json.Encode"
261{-# NOINLINE webgl #-}
263webgl = Canonical Pkg.webgl "WebGL"
266{-# NOINLINE texture #-}
268texture = Canonical Pkg.webgl "WebGL.Texture"
271{-# NOINLINE vector2 #-}
273vector2 = Canonical Pkg.linearAlgebra "Math.Vector2"
276{-# NOINLINE vector3 #-}
278vector3 = Canonical Pkg.linearAlgebra "Math.Vector3"
281{-# NOINLINE vector4 #-}
283vector4 = Canonical Pkg.linearAlgebra "Math.Vector4"
286{-# NOINLINE matrix4 #-}
288matrix4 = 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