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.Name as Name
26import qualified Data.Utf8 as Utf8
27import Data.Word (Word8)
28import Foreign.Ptr (Ptr, plusPtr, minusPtr)
29import Prelude hiding (maybe)
30import qualified System.FilePath as FP
32import qualified Elm.Package as Pkg
33import qualified Json.Decode as D
34import qualified Json.Encode as E
35import qualified Parse.Variable as Var
36import qualified Parse.Primitives as P
37import Parse.Primitives (Row, Col)
47toChars :: Raw -> String
52toFilePath :: Raw -> FilePath
54 map (\c -> if c == '.' then FP.pathSeparator else c) (Name.toChars name)
57toHyphenPath :: Raw -> FilePath
59 map (\c -> if c == '.' then '-' else c) (Name.toChars name)
66encode :: Raw -> E.Value
71decoder :: D.Decoder (Row, Col) Raw
73 D.customString parser (,)
80parser :: P.Parser (Row, Col) Raw
82 P.Parser $ \(P.State src pos end indent row col) cok _ cerr eerr ->
84 (# isGood, newPos, newCol #) = chompStart pos end col
86 if isGood && minusPtr newPos pos < 256 then
87 let !newState = P.State src newPos end indent row newCol in
88 cok (Utf8.fromPtr pos newPos) newState
90 else if col == newCol then
97chompStart :: Ptr Word8 -> Ptr Word8 -> Col -> (# Bool, Ptr Word8, Col #)
98chompStart pos end col =
100 !width = Var.getUpperWidth pos end
103 (# False, pos, col #)
105 chompInner (plusPtr pos width) end (col + 1)
108chompInner :: Ptr Word8 -> Ptr Word8 -> Col -> (# Bool, Ptr Word8, Col #)
109chompInner pos end col =
114 !word = P.unsafeIndex pos
115 !width = Var.getInnerWidthHelp pos end word
118 if word == 0x2E {-.-} then
119 chompStart (plusPtr pos 1) end (col + 1)
123 chompInner (plusPtr pos width) end (col + 1)
132 { _package :: !Pkg.Name
133 , _module :: !Name.Name
141instance Eq Canonical where
142 (==) (Canonical pkg1 name1) (Canonical pkg2 name2) =
143 name1 == name2 && pkg1 == pkg2
146instance Ord Canonical where
147 compare (Canonical pkg1 name1) (Canonical pkg2 name2) =
148 case compare name1 name2 of
150 EQ -> compare pkg1 pkg2
154instance Binary Canonical where
155 put (Canonical a b) = put a >> put b
156 get = liftM2 Canonical get get
163{-# NOINLINE basics #-}
165basics = Canonical Pkg.core Name.basics
170char = Canonical Pkg.core Name.char
173{-# NOINLINE string #-}
175string = Canonical Pkg.core Name.string
178{-# NOINLINE maybe #-}
180maybe = Canonical Pkg.core Name.maybe
183{-# NOINLINE result #-}
185result = Canonical Pkg.core Name.result
190list = Canonical Pkg.core Name.list
193{-# NOINLINE array #-}
195array = Canonical Pkg.core Name.array
200dict = Canonical Pkg.core Name.dict
203{-# NOINLINE tuple #-}
205tuple = Canonical Pkg.core Name.tuple
208{-# NOINLINE platform #-}
210platform = Canonical Pkg.core Name.platform
215cmd = Canonical Pkg.core "Platform.Cmd"
220sub = Canonical Pkg.core "Platform.Sub"
223{-# NOINLINE debug #-}
225debug = Canonical Pkg.core Name.debug
228{-# NOINLINE bitwise #-}
230bitwise = Canonical Pkg.core Name.bitwise
237{-# NOINLINE virtualDom #-}
238virtualDom :: Canonical
239virtualDom = Canonical Pkg.virtualDom Name.virtualDom
246{-# NOINLINE jsonDecode #-}
247jsonDecode :: Canonical
248jsonDecode = Canonical Pkg.json "Json.Decode"
251{-# NOINLINE jsonEncode #-}
252jsonEncode :: Canonical
253jsonEncode = Canonical Pkg.json "Json.Encode"
260{-# NOINLINE webgl #-}
262webgl = Canonical Pkg.webgl "WebGL"
265{-# NOINLINE texture #-}
267texture = Canonical Pkg.webgl "WebGL.Texture"
270{-# NOINLINE vector2 #-}
272vector2 = Canonical Pkg.linearAlgebra "Math.Vector2"
275{-# NOINLINE vector3 #-}
277vector3 = Canonical Pkg.linearAlgebra "Math.Vector3"
280{-# NOINLINE vector4 #-}
282vector4 = Canonical Pkg.linearAlgebra "Math.Vector4"
285{-# NOINLINE matrix4 #-}
287matrix4 = 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