@@ -1,342 +0,0 @@
1−{-# OPTIONS_GHC -Wall #-}
2−{-# LANGUAGE OverloadedStrings #-}
27− , int, float, bool, char, string
28− , maybe, result, list, array, dict, tuple, jsArray
29− , task, router, cmd, sub, platform, virtualDom
30− , shader, debug, debugger, bitwise, basics
31− , utils, negate, true, false, value
32− , node, program, main, dollar, identity
38−import Prelude hiding (drop, length, maybe, negate)
40−import qualified Data.ByteString.Builder as B
41−import qualified Data.ByteString.Internal as B
42−import qualified Data.ByteString.Short as S
43−import qualified Data.Char as Char
44−import qualified Data.String as String
45−import qualified Data.Text as Text
46−import qualified Data.Text.Encoding as Text
47−import Data.Word (Word8)
48−import Foreign.ForeignPtr (ForeignPtr)
55−newtype Name = Name { _name :: Text.Text }
64−contains :: Word8 -> Name -> Bool
65−contains word (Name name) =
66− Text.isInfixOf (Text.singleton (Char.chr (fromIntegral word))) name
69−startsWith :: Name -> Name -> Bool
70−startsWith (Name prefix) (Name name) =
71− Text.isPrefixOf prefix name
74−drop :: Int -> Name -> Name
75−drop numBytes (Name name) =
76− Name (Text.drop numBytes name)
83−toText :: Name -> Text.Text
88−toString :: Name -> String
89−toString (Name name) =
93−toBuilder :: Name -> B.Builder
94−toBuilder (Name name) =
95− Text.encodeUtf8Builder name
98−toDotlessBuilder :: Name -> B.Builder
99−toDotlessBuilder (Name name) =
100− Text.encodeUtf8Builder (Text.replace "." "$" name)
103−toShort :: Name -> S.ShortByteString
104−toShort (Name name) =
105− S.toShort (Text.encodeUtf8 name)
108−addIndex :: Name -> Int -> Name
109−addIndex (Name name) index =
110− Name (Text.append name (Text.pack (show index)))
113−addSafeIndex :: Name -> Int -> Name
114−addSafeIndex (Name name) index =
115− Name $ Text.append name $ Text.pack $
116− if Char.isDigit (Text.last name) then
122−toCompositeName :: [Name] -> Name
123−toCompositeName names =
124− Name (Text.cons '$' (Text.intercalate "$" (map _name names)))
127−sepBy :: Word8 -> Name -> Name -> Name
128−sepBy sep (Name home) (Name name) =
129− Name (Text.concat [ home, Text.singleton (Char.chr (fromIntegral sep)), name ])
136−fromForeignPtr :: ForeignPtr Word8 -> Int -> Int -> Name
137−fromForeignPtr fptr offset len =
138− Name (Text.decodeUtf8 (B.PS fptr offset len))
141−fromString :: String -> Name
143− Name (Text.pack str)
146−{- Takes a letter from 0 to 25 -}
147−fromLetter :: Int -> Name
149− Name (Text.singleton (Char.chr (97 + letter)))
152−fromText :: Text.Text -> Name
161−instance String.IsString Name where
163− Name (Text.pack str)
166−instance Binary Name where
167− put (Name name) = put name
180−{-# NOINLINE float #-}
185−{-# NOINLINE bool #-}
190−{-# NOINLINE char #-}
195−{-# NOINLINE string #-}
200−{-# NOINLINE maybe #-}
205−{-# NOINLINE result #-}
210−{-# NOINLINE list #-}
215−{-# NOINLINE array #-}
220−{-# NOINLINE dict #-}
225−{-# NOINLINE tuple #-}
230−{-# NOINLINE jsArray #-}
235−{-# NOINLINE task #-}
240−{-# NOINLINE router #-}
255−{-# NOINLINE platform #-}
257−platform = "Platform"
260−{-# NOINLINE virtualDom #-}
262−virtualDom = "VirtualDom"
265−{-# NOINLINE shader #-}
270−{-# NOINLINE debug #-}
275−{-# NOINLINE debugger #-}
277−debugger = "Debugger"
280−{-# NOINLINE bitwise #-}
285−{-# NOINLINE basics #-}
290−{-# NOINLINE utils #-}
295−{-# NOINLINE negate #-}
300−{-# NOINLINE true #-}
305−{-# NOINLINE false #-}
310−{-# NOINLINE value #-}
315−{-# NOINLINE node #-}
320−{-# NOINLINE program #-}
325−{-# NOINLINE main #-}
330−{-# NOINLINE dollar #-}
335−{-# NOINLINE identity #-}
337−identity = "identity"
340−{-# NOINLINE replModule #-}
342−replModule = "Elm_Repl"