Elm 0.9.0.2 → 0.10
raw patch · 50 files changed
+18662/−6548 lines, 50 filesdep +HTFdep +aesondep +aeson-prettydep −hjsminsetup-changednew-component:exe:elm-doc
Dependencies added: HTF, aeson, aeson-pretty, language-ecmascript, text
Dependencies removed: hjsmin
Files
- Elm.cabal +51/−11
- LICENSE +1/−1
- Setup.hs +178/−1
- changelog.txt +11/−0
- compiler/Compiler.hs +45/−45
- compiler/Docs.hs +162/−0
- compiler/Generate/Cases.hs +20/−23
- compiler/Generate/Html.hs +4/−22
- compiler/Generate/JavaScript.hs +350/−298
- compiler/Generate/Noscript.hs +1/−1
- compiler/Initialize.hs +30/−12
- compiler/Language/Elm.hs +3/−11
- compiler/Parse/Binop.hs +15/−42
- compiler/Parse/Declaration.hs +7/−21
- compiler/Parse/Expression.hs +45/−44
- compiler/Parse/Helpers.hs +115/−20
- compiler/Parse/Literal.hs +4/−1
- compiler/Parse/Module.hs +1/−1
- compiler/Parse/Parse.hs +27/−4
- compiler/Parse/Pattern.hs +1/−74
- compiler/Parse/Type.hs +15/−21
- compiler/SourceSyntax/Declaration.hs +31/−1
- compiler/SourceSyntax/Expression.hs +10/−8
- compiler/SourceSyntax/Literal.hs +2/−2
- compiler/SourceSyntax/Module.hs +18/−7
- compiler/SourceSyntax/Pattern.hs +2/−2
- compiler/SourceSyntax/PrettyPrint.hs +6/−1
- compiler/SourceSyntax/Type.hs +12/−1
- compiler/Transform/Canonicalize.hs +17/−7
- compiler/Transform/Check.hs +45/−1
- compiler/Transform/SortDefinitions.hs +1/−1
- compiler/Transform/Substitute.hs +19/−6
- compiler/Type/Alias.hs +135/−0
- compiler/Type/Constrain/Expression.hs +24/−21
- compiler/Type/Constrain/Literal.hs +5/−5
- compiler/Type/Constrain/Pattern.hs +16/−3
- compiler/Type/Environment.hs +13/−8
- compiler/Type/ExtraChecks.hs +73/−0
- compiler/Type/Inference.hs +25/−18
- compiler/Type/PrettyPrint.hs +3/−0
- compiler/Type/Solve.hs +4/−2
- compiler/Type/State.hs +20/−13
- compiler/Type/Type.hs +5/−4
- compiler/Type/Unify.hs +6/−4
- compiler/Unique.hs +0/−19
- data/docs.json +10034/−0
- data/elm-runtime.js +7028/−5754
- data/interfaces.data binary
- tests/Everything.hs +0/−7
- tests/Main.hs +22/−0
Elm.cabal view
@@ -1,5 +1,5 @@ Name: Elm-Version: 0.9.0.2+Version: 0.10 Synopsis: The Elm language module. Description: Elm aims to make client-side web-development more pleasant. It is a statically/strongly typed, functional reactive@@ -14,7 +14,7 @@ Author: Evan Czaplicki Maintainer: info@elm-lang.org-Copyright: Copyright: (c) 2011-2012 Evan Czaplicki+Copyright: Copyright: (c) 2011-2013 Evan Czaplicki Category: Compiler, Language @@ -22,7 +22,7 @@ Extra-source-files: changelog.txt Data-dir: data-Data-files: elm-runtime.js interfaces.data+Data-files: elm-runtime.js interfaces.data docs.json Cabal-version: >=1.9 source-repository head@@ -32,8 +32,7 @@ Library exposed-modules: Language.Elm Hs-Source-Dirs: compiler- other-modules: Unique,- SourceSyntax.Declaration,+ other-modules: SourceSyntax.Declaration, SourceSyntax.Expression, SourceSyntax.Everything, SourceSyntax.Helpers,@@ -63,11 +62,13 @@ Parse.Parse, Parse.Pattern, Parse.Type,+ Type.Alias, Type.Constrain.Declaration, Type.Constrain.Expression, Type.Constrain.Literal, Type.Constrain.Pattern, Type.Environment,+ Type.ExtraChecks, Type.Fragment, Type.Inference, Type.PrettyPrint,@@ -86,8 +87,8 @@ containers >= 0.3, directory, filepath,- hjsmin, indents,+ language-ecmascript, mtl >= 2, pandoc >= 1.10, parsec >= 3.1.1,@@ -100,8 +101,7 @@ Main-is: Compiler.hs ghc-options: -threaded -O2 Hs-Source-Dirs: compiler- other-modules: Unique,- SourceSyntax.Declaration,+ other-modules: SourceSyntax.Declaration, SourceSyntax.Expression, SourceSyntax.Everything, SourceSyntax.Helpers,@@ -131,11 +131,13 @@ Parse.Parse, Parse.Pattern, Parse.Type,+ Type.Alias, Type.Constrain.Declaration, Type.Constrain.Expression, Type.Constrain.Literal, Type.Constrain.Pattern, Type.Environment,+ Type.ExtraChecks, Type.Fragment, Type.Inference, Type.PrettyPrint,@@ -154,8 +156,8 @@ containers >= 0.3, directory, filepath,- hjsmin, indents,+ language-ecmascript, mtl >= 2, pandoc >= 1.10, parsec >= 3.1.1,@@ -164,8 +166,46 @@ union-find, uniplate +Executable elm-doc+ Main-is: Docs.hs+ Hs-Source-Dirs: compiler+ other-modules: SourceSyntax.Declaration,+ SourceSyntax.Everything,+ SourceSyntax.Expression,+ SourceSyntax.Helpers,+ SourceSyntax.Literal,+ SourceSyntax.Location,+ SourceSyntax.Module,+ SourceSyntax.Pattern,+ SourceSyntax.PrettyPrint,+ SourceSyntax.Type,+ Parse.Binop,+ Parse.Declaration,+ Parse.Expression,+ Parse.Helpers,+ Parse.Literal,+ Parse.Module,+ Parse.Pattern,+ Parse.Type++ Build-depends: aeson,+ aeson-pretty,+ base >=4.2 && <5,+ binary,+ bytestring,+ cmdargs,+ containers >= 0.3,+ directory,+ filepath,+ indents,+ mtl >= 2,+ pandoc >= 1.10,+ parsec >= 3.1.1,+ pretty,+ text+ Test-Suite test-elm Type: exitcode-stdio-1.0 Hs-Source-Dirs: tests- Main-is: Everything.hs- build-depends: base+ Main-is: Main.hs+ build-depends: base, directory, HTF
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c)2012, Evan Czaplicki+Copyright (c) 2012-2013, Evan Czaplicki All rights reserved.
Setup.hs view
@@ -1,2 +1,179 @@ import Distribution.Simple-main = defaultMain+import Distribution.Simple.LocalBuildInfo+import Distribution.Simple.Setup+import Distribution.PackageDescription++import System.Cmd+import System.Directory+import System.FilePath+import System.IO+import System.Process++import Control.Monad+import qualified Data.Binary as Binary+import qualified Data.ByteString.Lazy as BS+import qualified Data.List as List++-- Part 1+-- ------+-- Add a build callout+-- We need to build elm-doc and run it because that generates the file "docs.json"+-- needs by Libraries.hs which is part of the elm library and executable+-- Unfort. there seems to be no way to tell cabal that:+-- (a) elm-doc generates docs.json, and+-- (b) elm (library) depends on docs.json+-- Therefore, we either use make instead (or a script), or hack around in cabal++-- Part 2+-- ------+-- Add a post-build callout.+-- We need to build the runtime.js after we've built elm (because we use elm to generate some of the JavaScript),+-- but before cabal does the install file copy step++-- Assumptions+-- Elm.cabal expects the generated files to end up in dist/data+-- git won't look in dist + cabal will clean it+rtsDir :: LocalBuildInfo -> FilePath+rtsDir lbi = "data"++tempDir :: LocalBuildInfo -> FilePath+tempDir lbi = "temp"++-- The runtime is called:+rts :: LocalBuildInfo -> FilePath+rts lbi = rtsDir lbi </> "elm-runtime.js"++-- The runtime is called:+docs :: LocalBuildInfo -> FilePath+docs lbi = rtsDir lbi </> "docs.json"++-- The interfaces for the Standard Libraries live in:+interfaces :: LocalBuildInfo -> FilePath+interfaces lbi = rtsDir lbi </> "interfaces.data"++elm :: LocalBuildInfo -> FilePath+elm lbi = buildDir lbi </> "elm" </> "elm"++document :: LocalBuildInfo -> FilePath+document lbi = buildDir lbi </> "elm-doc" </> "elm-doc"++-- Care! This appears to be based on an unstable API+-- See: http://www.haskell.org/cabal/release/cabal-latest/doc/API/Cabal/Distribution-Simple.html#2+++main :: IO ()+main = defaultMainWithHooks simpleUserHooks { postBuild = myPostBuild }+++-- Build++-- note(1): We use to include docs.json directly into LoadLibraries at compile time+-- If docs.json is used in other (template) haskell files, they should be copied+-- and compiled in a separate directory (eg, dist/copiedSrc).+-- This is to make sure they are re-compiled on docs.json changes.+-- Copying is a better solution than 'touch'ing the source files+-- (touch is non-portable and confusing wrt RCS).++-- In the PackageDescription, the list of stuff to build is held in library+-- (in a Maybe) and the executables list. We want a PackageDescription that+-- only mentions the executable 'name'+filterExe :: String -> PackageDescription -> PackageDescription+filterExe name pd = pd {+ library = Nothing,+ executables = filter (\x -> (exeName x == name)) (executables pd)+ }+++-- Post Build++myPostBuild :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()+myPostBuild as bfs pd lbi = do+ putStrLn "Custom build step: compiling standard libraries"+ (elmos, elmis) <- compileLibraries lbi+ putStrLn "Custom build step: build interfaces.data"+ buildInterfaces lbi elmis+ putStrLn "Custom build step: build elm-runtime.js"+ buildRuntime lbi elmos+ putStrLn "Custom build step: build docs.json"+ buildDocs lbi+ removeDirectoryRecursive (tempDir lbi)+ removeDirectoryRecursive ("libraries" </> "docs")+ postBuild simpleUserHooks as bfs pd lbi+++compileLibraries lbi = do+ let temp = tempDir lbi -- temp+ rts = rtsDir lbi -- data+ createDirectoryIfMissing True temp+ createDirectoryIfMissing True rts+ out_c <- canonicalizePath temp -- temp (root folder)+ elm_c <- canonicalizePath (elm lbi) -- dist/build/elm/elm+ doc_c <- canonicalizePath (document lbi) -- dist/build/elm-doc/elm-doc+ rtd_c <- canonicalizePath rts -- data++ let make file = do+ -- replace 'system' call with 'runProcess' which handles args better+ -- and allows env variable "Elm_datadir" which is used by LoadLibraries+ -- to find docs.json+ let args = [ "--only-js", "--make", "--no-prelude"+ , "--cache-dir="++out_c, "--build-dir="++out_c, file ]+ arg = Just [("Elm_datadir", rtd_c)]+ handle <- runProcess elm_c args Nothing arg Nothing Nothing Nothing+ exitCode <- waitForProcess handle+ return ( out_c </> replaceExtension file "elmo"+ , out_c </> replaceExtension file "elmi")++ setCurrentDirectory "libraries"+ paths <- getFiles ".elm" "."+ files <- unzip `fmap` mapM make paths+ mapM_ (\path -> rawSystem doc_c [path]) paths+ setCurrentDirectory ".."+ return files++buildInterfaces :: LocalBuildInfo -> [FilePath] -> IO ()+buildInterfaces lbi elmis = do+ createDirectoryIfMissing True (rtsDir lbi)+ let ifaces = interfaces lbi+ ifaceHandle <- openBinaryFile ifaces WriteMode+ BS.hPut ifaceHandle (Binary.encode (length elmis))+ let append file = do+ handle <- openBinaryFile file ReadMode+ bits <- hGetContents handle+ length bits `seq` hPutStr ifaceHandle bits+ hClose handle+ mapM_ append elmis+ hClose ifaceHandle++buildRuntime :: LocalBuildInfo -> [FilePath] -> IO ()+buildRuntime lbi elmos = do+ createDirectoryIfMissing True (rtsDir lbi)+ let rts' = rts lbi+ writeFile rts' "var Elm = {}; Elm.Native = {}; Elm.Native.Graphics = {};\n\+ \var ElmRuntime = {}; ElmRuntime.Render = {};\n"+ mapM_ (appendTo rts') =<< getFiles ".js" "libraries"+ mapM_ (appendTo rts') elmos+ mapM_ (appendTo rts') =<< getFiles ".js" "runtime"++buildDocs :: LocalBuildInfo -> IO ()+buildDocs lbi = do+ createDirectoryIfMissing True (rtsDir lbi)+ let docs' = docs lbi+ writeFile docs' "[\n"+ json <- getFiles ".json" ("libraries" </> "docs")+ let appends = map (appendTo docs') json+ addCommas = List.intersperse (appendFile docs' ",\n")+ sequence_ (addCommas appends)+ appendFile docs' "\n]"++getFiles ext dir = do+ contents <- map (dir </>) `fmap` getDirectoryContents dir+ let files = filter (\f -> takeExtension f == ext) contents+ dirs = filter (not . hasExtension) contents+ filess <- mapM (getFiles ext) dirs+ return (files ++ concat filess)++appendTo :: FilePath -> FilePath -> IO ()+appendTo destination source = do+ str <- readFile source+ length str `seq` return ()+ appendFile destination str
changelog.txt view
@@ -1,4 +1,15 @@ +Release 0.9.1+=============++ * Allow custom precedence and associativity for user-defined infix ops+ * Realias types before printing+ * Switch to Tango color scheme, adding a bunch of nice colors+ * add the greyscale function for easily producing greys+ * Check the type of main+ * Fix miscellaneous bugs in type checker+ * Switch name of Matrix2D to Transform2D+ Release 0.9 ===========
compiler/Compiler.hs view
@@ -13,9 +13,7 @@ import System.IO import GHC.Conc -import qualified Text.Blaze.Html.Renderer.Pretty as Pretty-import qualified Text.Blaze.Html.Renderer.String as Normal-import qualified Text.Jasmine as JS+import Text.Blaze.Html.Renderer.Pretty (renderHtml) import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.ByteString.Lazy as L @@ -25,13 +23,13 @@ import Parse.Module (getModuleName) import Initialize (buildFromSource, getSortedDependencies) import Generate.JavaScript (jsModule)-import Generate.Html (createHtml, JSStyle(..), JSSource(..))+import Generate.Html (createHtml, JSSource(..)) import Paths_Elm import SourceSyntax.PrettyPrint (pretty, variable) import Text.PrettyPrint as P import qualified Type.Type as Type-import qualified Data.Traversable as Traverse+import qualified Type.Alias as Alias data Flags = Flags { make :: Bool@@ -42,36 +40,38 @@ , print_program :: Bool , scripts :: [FilePath] , no_prelude :: Bool- , minify :: Bool , cache_dir :: FilePath , build_dir :: FilePath+ , src_dir :: [FilePath] } deriving (Data,Typeable,Show,Eq) flags = Flags- { make = False+ { files = def &= args &= typ "FILES"+ , make = False &= help "automatically compile dependencies."- , files = def &= args &= typ "FILES"- , runtime = Nothing &= typFile- &= help "Specify a custom location for Elm's runtime system." , only_js = False &= help "Compile only to JavaScript."- , print_types = False- &= help "Print out infered types of top-level definitions."- , print_program = False- &= help "Print out an internal representation of a program."- , scripts = [] &= typFile- &= help "Load JavaScript files in generated HTML. Files will be included in the given order." , no_prelude = False &= help "Do not import Prelude by default, used only when compiling standard libraries."- , minify = False- &= help "Minify generated JavaScript and HTML"+ , scripts = [] &= typFile+ &= help "Load JavaScript files in generated HTML. Files will be included in the given order."+ , runtime = Nothing &= typFile+ &= help "Specify a custom location for Elm's runtime system." , cache_dir = "cache" &= typFile &= help "Directory for files cached to make builds faster. Defaults to cache/ directory." , build_dir = "build" &= typFile &= help "Directory for generated HTML and JS files. Defaults to build/ directory."+ , src_dir = ["."] &= typFile+ &= help "Additional source directories besides project root. Searched when using --make"+ , print_types = False+ &= help "Print out infered types of top-level definitions."+ , print_program = False+ &= help "Print out an internal representation of a program." } &= help "Compile Elm programs to HTML, CSS, and JavaScript."- &= summary ("The Elm Compiler " ++ showVersion version ++ ", (c) Evan Czaplicki")+ &= helpArg [explicit, name "help", name "h"]+ &= versionArg [explicit, name "version", name "v", summary (showVersion version)]+ &= summary ("The Elm Compiler " ++ showVersion version ++ ", (c) Evan Czaplicki 2011-2013") main :: IO () main = do setNumCapabilities =<< getNumProcessors@@ -118,7 +118,7 @@ then return False else do tsrc <- getModificationTime filePath tint <- getModificationTime (elmo flags filePath)- return (tsrc < tint)+ return (tsrc <= tint) number :: String number = "[" ++ show moduleNum ++ " of " ++ show numModules ++ "]"@@ -146,12 +146,12 @@ True -> print . pretty $ program modul return modul - if print_types flags then printTypes metaModule else return ()- tipes <- Traverse.traverse Type.toSrcType (types metaModule)+ when (print_types flags) (printTypes interfaces metaModule) let interface = Canonical.interface name $ ModuleInterface {- iTypes = tipes,+ iTypes = types metaModule, iAdts = datatypes metaModule,- iAliases = aliases metaModule+ iAliases = aliases metaModule,+ iFixities = fixities metaModule } createDirectoryIfMissing True . dropFileName $ elmi flags filePath handle <- openBinaryFile (elmi flags filePath) WriteMode@@ -160,11 +160,11 @@ writeFile (elmo flags filePath) (jsModule metaModule) return (name,interface) -printTypes metaModule = do+printTypes interfaces metaModule = do putStrLn ""+ let rules = Alias.rules interfaces metaModule forM_ (Map.toList $ types metaModule) $ \(n,t) -> do- pt <- Type.extraPretty t- print $ variable n <+> P.text ":" <+> pt+ print $ variable n <+> P.text ":" <+> pretty (Alias.realias rules t) putStrLn "" getRuntime :: Flags -> IO FilePath@@ -176,34 +176,34 @@ build :: Flags -> FilePath -> IO () build flags rootFile = do let noPrelude = no_prelude flags- files <- if make flags then getSortedDependencies noPrelude rootFile else return [rootFile]+ files <- if make flags then getSortedDependencies (src_dir flags) noPrelude rootFile+ else return [rootFile] let ifaces = if noPrelude then Map.empty else Prelude.interfaces (moduleName, interfaces) <- buildFiles flags (length files) ifaces "" files- js <- foldM appendToOutput "" files- case only_js flags of+ js <- foldM appendToOutput BS.empty files++ (extension, code) <- case only_js flags of True -> do putStr "Generating JavaScript ... "- writeFile (buildPath flags rootFile "js") (genJs js)- putStrLn "Done"+ return ("js", js) False -> do putStr "Generating HTML ... "- runtime <- getRuntime flags- let html = genHtml $ createHtml runtime (takeBaseName rootFile) (sources js) moduleName ""- htmlFile = buildPath flags rootFile "html"- createDirectoryIfMissing True (takeDirectory htmlFile)- writeFile htmlFile html- putStrLn "Done"+ rtsPath <- getRuntime flags+ return ("html", BS.pack . renderHtml $+ createHtml rtsPath (takeBaseName rootFile) (sources js) moduleName "") + let targetFile = buildPath flags rootFile extension+ createDirectoryIfMissing True (takeDirectory targetFile)+ BS.writeFile targetFile code+ putStrLn "Done"+ where- appendToOutput :: String -> FilePath -> IO String+ appendToOutput :: BS.ByteString -> FilePath -> IO BS.ByteString appendToOutput js filePath =- do src <- readFile (elmo flags filePath)- return (src ++ js)+ do src <- BS.readFile (elmo flags filePath)+ return (BS.append src js) - genHtml = if minify flags then Normal.renderHtml else Pretty.renderHtml- genJs = if minify flags then BS.unpack . JS.minify . BS.pack else id- sources js = map Link (scripts flags) ++- [ Source (if minify flags then Minified else Readable) js ]+ sources js = map Link (scripts flags) ++ [ Source js ] buildFiles :: Flags -> Int -> Interfaces -> String -> [FilePath] -> IO (String, Interfaces)
+ compiler/Docs.hs view
@@ -0,0 +1,162 @@+{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}+module Main where++import System.Console.CmdArgs+import System.Directory+import System.FilePath+import System.Exit++import Control.Applicative ((<$>), (<*>))+import Data.Aeson+import Data.Aeson.Encode.Pretty+import qualified Data.List as List+import qualified Data.Map as Map+import qualified Data.ByteString.Lazy as BS+import qualified Data.Text as Text++import SourceSyntax.Helpers (isSymbol)+import SourceSyntax.Type (Type(..))+import SourceSyntax.Declaration (Declaration(..), Assoc(..))+import SourceSyntax.Expression (Def(..))++import Text.Parsec hiding (newline,spaces)+import Parse.Declaration (alias,datatype,infixDecl)+import Parse.Expression (typeAnnotation)+import Parse.Helpers+import Parse.Module (moduleDef)++data Flags = Flags+ { files :: [FilePath] }+ deriving (Data,Typeable,Show,Eq)++defaultFlags = Flags+ { files = def &= args &= typ "FILES"+ } &= help "Generate documentation for Elm"+ &= summary ("Generate documentation for Elm, (c) Evan Czaplicki")++main = do+ flags <- cmdArgs defaultFlags+ mapM parseFile (files flags)++config = Config { confIndent = 2, confCompare = keyOrder keys }+ where+ keys = ["name","document","comment","raw","aliases","datatypes"+ ,"values","typeVariables","type","constructors"]++parseFile path = do+ source <- readFile path+ case iParse docs source of+ Right json -> do+ putStrLn $ "Documenting " ++ path+ let docPath = "docs" </> replaceExtension path ".json"+ createDirectoryIfMissing True (dropFileName docPath)+ BS.writeFile docPath (encodePretty' config json)+ Left err -> do+ putStrLn $ "Parse error in " ++ path ++ " at " ++ show err+ exitFailure++docs :: IParser Value+docs = do+ (name, exports, structure) <- moduleDocs+ things <- document+ return $ documentToJson name exports structure things++docComment :: IParser String+docComment = do+ try (string "{-|")+ contents <- closeComment+ let reversed = dropWhile (`elem` " \n\r") . drop 2 $ reverse contents+ return $ dropWhile (==' ') (reverse reversed)++moduleDocs = do+ optional freshLine+ (names,exports) <- moduleDef+ manyTill (string " " <|> newline <?> "more whitespace")+ (lookAhead (string "{-|") <?> "module documentation comment")+ structure <- docComment+ return (List.intercalate "." names, exports, structure)++document :: IParser [(String, Declaration t v, String)]+document = onFreshLines (\t ts -> ts ++ [t]) [] docThing++docThing :: IParser (String, Declaration t v, String)+docThing = uncommentable <|> commented <|> uncommented ""+ where+ uncommentable = do+ ifx <- infixDecl+ return ("", ifx, "")++ commented = do+ comment <- docComment+ freshLine+ uncommented comment++ uncommented comment = do+ (src,def) <- withSource $ choice [ alias, datatype, Definition <$> typeAnnotation ]+ return (comment, def, src)+++documentToJson name exports structure things =+ object $ [ "name" .= name+ , "document" .= structure+ , "values" .= toList values+ , "aliases" .= toList aliases+ , "datatypes" .= toList adts+ ]+ where+ (values, aliases, adts) = collect Map.empty Map.empty Map.empty Map.empty things+ + toList dict = map object . Map.elems $ filterPublics dict++ exportMap = Map.fromList (zip exports exports)+ filterPublics dict =+ case Map.null exportMap of+ True -> dict+ False -> Map.filterWithKey (\k _ -> Map.member k exportMap) dict++collect infixes types aliases adts things =+ case things of+ [] -> (Map.union customOps nonCustomOps, aliases, adts)+ where+ nonCustomOps = Map.mapWithKey addDefaultInfix $ Map.difference types infixes+ addDefaultInfix name pairs+ | all isSymbol name = addInfix (L, 9 :: Int) pairs+ | otherwise = pairs++ customOps = Map.intersectionWith addInfix infixes types+ addInfix (assoc,prec) pairs =+ [ "associativity" .= show assoc, "precedence" .= prec ] ++ pairs++ (comment, decl, source) : rest ->+ case decl of+ Fixity assoc prec name ->+ collect (Map.insert name (assoc,prec) infixes) types aliases adts rest+ Definition (TypeAnnotation name tipe) ->+ collect infixes (insert name [ "type" .= tipe ] types) aliases adts rest+ TypeAlias name vars tipe ->+ let fields = ["typeVariables" .= vars, "type" .= tipe ]+ in collect infixes types (insert name fields aliases) adts rest+ Datatype name vars ctors ->+ let tipe = Data name (map Var vars)+ fields = ["typeVariables" .= vars, "constructors" .= map (ctorToJson tipe) ctors ]+ in collect infixes types aliases (insert name fields adts) rest+ where+ insert name fields dict = Map.insert name (obj name fields) dict+ obj name fields =+ [ "name" .= name, "raw" .= source, "comment" .= comment ] ++ fields++instance ToJSON Type where+ toJSON tipe =+ case tipe of+ Lambda t1 t2 -> toJSON [ "->", toJSON t1, toJSON t2 ]+ Var x -> toJSON x+ Data name ts -> toJSON (toJSON name : map toJSON ts)+ EmptyRecord -> object []+ Record fields ext -> object $ map (\(n,t) -> Text.pack n .= toJSON t) fields'+ where fields' = case ext of+ EmptyRecord -> fields+ _ -> ("_",ext) : fields++ctorToJson tipe (ctor, tipes) =+ object [ "name" .= ctor+ , "type" .= foldr Lambda tipe tipes ]
compiler/Generate/Cases.hs view
@@ -1,23 +1,27 @@-module Generate.Cases (caseToMatch, Match (..), Clause (..), matchSubst) where+module Generate.Cases (toMatch, Match (..), Clause (..), matchSubst) where -import Control.Arrow (first)-import Control.Monad (liftM,foldM)+import Control.Applicative ((<$>),(<*>))+import Control.Arrow (first,second)+import Control.Monad.State import Data.List (groupBy,sortBy,lookup) import Data.Maybe (fromMaybe) -import Unique import SourceSyntax.Location import SourceSyntax.Literal import SourceSyntax.Pattern import SourceSyntax.Expression import Transform.Substitute -caseToMatch patterns = do++toMatch :: [(Pattern, LExpr t v)] -> State Int (String, Match t v)+toMatch patterns = do v <- newVar- (,) v `liftM` match [v] (map (first (:[])) patterns) Fail+ (,) v <$> match [v] (map (first (:[])) patterns) Fail -newVar = do n <- guid- return $ "case" ++ show n+newVar :: State Int String+newVar = do n <- get+ modify (+1)+ return $ "_case" ++ show n data Match t v = Match String [Clause t v] (Match t v)@@ -51,7 +55,7 @@ isVar p = not (isCon p) -match :: [String] -> [([Pattern],LExpr t v)] -> Match t v -> Unique (Match t v)+match :: [String] -> [([Pattern],LExpr t v)] -> Match t v -> State Int (Match t v) match [] [] def = return def match [] [([],e)] Fail = return $ Other e match [] [([],e)] Break = return $ Other e@@ -68,8 +72,7 @@ PAlias x pattern -> (pattern:ps, L s $ subst x (Var v) e) _ -> c -matchVar :: [String] -> [([Pattern],LExpr t v)] -> Match t v- -> Unique (Match t v)+matchVar :: [String] -> [([Pattern],LExpr t v)] -> Match t v -> State Int (Match t v) matchVar (v:vs) cs def = match vs (map subVar cs) def where subVar (p:ps, ce@(L s e)) = (ps, L s $ subOnePattern p e)@@ -81,9 +84,8 @@ PRecord fs -> foldr (\x -> subst x (Access (L s (Var v)) x)) e fs -matchCon :: [String] -> [([Pattern],LExpr t v)] -> Match t v- -> Unique (Match t v)-matchCon (v:vs) cs def = (flip (Match v) def) `liftM` mapM toClause css+matchCon :: [String] -> [([Pattern],LExpr t v)] -> Match t v -> State Int (Match t v)+matchCon (v:vs) cs def = (flip (Match v) def) <$> mapM toClause css where css = groupBy eq (sortBy cmp cs) @@ -102,14 +104,10 @@ (PData name _ : _, _) -> matchClause (Left name) (v:vs) cs Break (PLiteral lit : _, _) -> matchClause (Right lit) (v:vs) cs Break -matchClause :: Either String Literal- -> [String]- -> [([Pattern],LExpr t v)]- -> Match t v- -> Unique (Clause t v)+--matchClause :: Either String Literal -> [String] -> [([Pattern],LExpr t v)] -> Match t v -> State Int (Clause a) matchClause c (v:vs) cs def = do vs' <- getVars- Clause c vs' `liftM` match (vs' ++ vs) (map flatten cs) def+ Clause c vs' <$> match (vs' ++ vs) (map flatten cs) def where flatten (p:ps, e) =@@ -119,10 +117,9 @@ getVars = case head cs of- (PData _ ps : _, _) -> mapM (\_ -> newVar) ps+ (PData _ ps : _, _) -> forM ps (const newVar) (PLiteral _ : _, _) -> return [] -matchMix :: [String] -> [([Pattern],LExpr t v)] -> Match t v- -> Unique (Match t v)+matchMix :: [String] -> [([Pattern],LExpr t v)] -> Match t v -> State Int (Match t v) matchMix vs cs def = foldM (flip $ match vs) def (reverse css) where css = groupBy (\p1 p2 -> isCon p1 == isCon p2) cs
compiler/Generate/Html.hs view
@@ -1,8 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} module Generate.Html- (generateHtml,- createHtml,- JSStyle (..),+ (createHtml, JSSource (..) ) where @@ -10,37 +8,21 @@ import qualified Text.Blaze.Html5 as H import Text.Blaze.Html5 ((!)) import qualified Text.Blaze.Html5.Attributes as A--import Text.Jasmine (minify) import qualified Data.ByteString.Lazy.Char8 as BS import Initialize (buildFromSource) import Generate.JavaScript import Generate.Noscript -data JSStyle = Minified | Readable-data JSSource = Link String | Source JSStyle String+data JSSource = Link String | Source BS.ByteString makeScript :: JSSource -> H.Html makeScript source = case source of Link src -> H.script ! A.type_ "text/javascript" ! A.src (H.toValue src) $ ""- Source style src ->+ Source src -> H.script ! A.type_ "text/javascript" $- preEscapedToMarkup $ case style of - Minified -> BS.unpack . minify . BS.pack $ src- Readable -> src---- |This function compiles Elm code into simple HTML.------ Usage example:------ > generateHtml "/elm-min.js" "Some title" [elmFile|elm-source/somePage.elm|]-generateHtml :: String -- ^ Location of elm-runtime.js as expected by the browser- -> String -- ^ The page title- -> String -- ^ The elm source code.- -> H.Html-generateHtml libLoc title source = error "function 'generateHtml' is unimplemented for now"+ preEscapedToMarkup $ BS.unpack src createHtml :: FilePath -> String -> [JSSource] -> String -> String -> H.Html createHtml libLoc title scripts moduleName noscript =
compiler/Generate/JavaScript.hs view
@@ -1,365 +1,417 @@-module Generate.JavaScript (jsModule) where+module Generate.JavaScript where -import Control.Arrow (first,second)-import Control.Monad (liftM,(<=<),join,ap)-import Data.Char (isAlpha,isDigit)+import Control.Arrow (first,(***))+import Control.Applicative ((<$>),(<*>))+import Control.Monad.State import qualified Data.List as List import qualified Data.Map as Map import qualified Data.Set as Set-import Data.Either (partitionEithers) import qualified Text.Pandoc as Pan -import Unique-import Generate.Cases+import qualified Generate.Cases as Case import SourceSyntax.Everything import SourceSyntax.Location import qualified Transform.SortDefinitions as SD+import Language.ECMAScript3.Syntax+import Language.ECMAScript3.PrettyPrint+import Parse.Helpers (jsReserveds) -deprime :: String -> String-deprime = map (\c -> if c == '\'' then '$' else c)+makeSafe :: String -> String+makeSafe = List.intercalate "." . map dereserve . split . deprime+ where+ deprime = map (\c -> if c == '\'' then '$' else c)+ dereserve x = case Set.member x jsReserveds of+ False -> x+ True -> "$" ++ x -indent = concatMap f- where f '\n' = "\n "- f c = [c]+split = go []+ where+ go vars str =+ case break (=='.') str of+ (x,'.':rest) | isOp x -> vars ++ [x ++ '.' : rest]+ | otherwise -> go (vars ++ [x]) rest+ (x,[]) -> vars ++ [x] -internalImports name =- [ ("N" , "Elm.Native"),- ("_N", "N.Utils(elm)"),- ("_L", "N.List(elm)"),- ("_E", "N.Error(elm)"),- ("_J", "N.JavaScript(elm)"),- ("_str", "_J.toString"),- ("$moduleName", quoted name)- ]+var name = Id () (makeSafe name)+ref name = VarRef () (var name)+prop name = PropId () (var name)+f <| x = CallExpr () f [x]+args ==> e = FuncExpr () Nothing (map var args) [ ReturnStmt () (Just e) ]+function args stmts = FuncExpr () Nothing (map var args) stmts+call = CallExpr ()+string = StringLit () -parens s = "(" ++ s ++ ")"-brackets s = "{" ++ s ++ "}"-commaSep = List.intercalate ", "-dotSep = List.intercalate "."-jsObj = brackets . commaSep-jsList ss = "["++ List.intercalate "," ss ++"]"-jsFunc args body = "function(" ++ args ++ "){" ++ indent body ++ "}"-assign x e = "\nvar " ++ x ++ " = " ++ e ++ ";"-ret e = "\nreturn "++ e ++";"-quoted s = "'" ++ concatMap f s ++ "'"- where f '\n' = "\\n"- f '\'' = "\\'"- f '\t' = "\\t"- f '\"' = "\\\""- f '\\' = "\\\\"- f c = [c]+dotSep (x:xs) = foldl (DotRef ()) (ref x) (map var xs)+obj = dotSep . split -globalAssign n e = "\n" ++ assign' n e ++ ";"-assign' n e = n ++ " = " ++ e+varDecl x expr =+ VarDecl () (var x) (Just expr) -jsModule :: MetadataModule t v -> String-jsModule modul =- run $ do- body <- toJS . fst . SD.flattenLets [] $ program modul- foreignImport <- mapM importEvent (foreignImports modul)- return $ concat [ setup ("Elm": names modul)- , globalAssign ("Elm." ++ modName)- (jsFunc "elm" $ makeProgram body foreignImport) ]- where- modName = dotSep (names modul)- makeProgram body foreignImport =- concat [ "\nvar " ++ usefulFuncs ++ ";"- , concatMap jsImport (imports modul)- , concat foreignImport- , assign "_op" "{}"- , body- , concatMap exportEvent $ foreignExports modul- , jsExports- ]- setup names = concatMap (\n -> globalAssign n $ n ++ " || {}") .- map dotSep . drop 2 . List.inits $ init names- usefulFuncs = commaSep (map (uncurry assign') (internalImports modName))+include alias moduleName =+ varDecl alias (obj (moduleName ++ ".make") <| ref "elm") - jsExports = setup ("elm" : names modul) ++- ret (assign' ("elm." ++ modName) (brackets exs))- where- exs = indent . commaSep . concatMap (pair . deprime) $ "_op" : exports modul- pair x | isOp x = []- | otherwise = ["\n" ++ x ++ " : " ++ x]+internalImports name =+ VarDeclStmt () + [ varDecl "N" (obj "Elm.Native")+ , include "_N" "N.Utils"+ , include "_L" "N.List"+ , include "_E" "N.Error"+ , include "_J" "N.JavaScript"+ , varDecl "$moduleName" (string name)+ ] +literal lit =+ case lit of+ Chr c -> obj "_N.chr" <| string [c]+ Str s -> string s+ IntNum n -> IntLit () n+ FloatNum n -> NumLit () n+ Boolean b -> BoolLit () b - importEvent (js,base,elm,_) =- do v <- toJS' base- return $ concat [ "\nvar " ++ elm ++ "=Signal.constant(" ++ v ++ ");"- , "\ndocument.addEventListener('", js- , "_' + elm.id, function(e) { elm.notify(", elm- , ".id, e.value); });" ]+expression :: LExpr () () -> State Int (Expression ())+expression (L span expr) =+ case expr of+ Var x -> return $ ref x+ Literal lit -> return $ literal lit - exportEvent (js,elm,_) =- concat [ "\nA2( Signal.lift, function(v) { "- , "var e = document.createEvent('Event');"- , "e.initEvent('", js, "_' + elm.id, true, true);"- , "e.value = v;"- , "document.dispatchEvent(e); return v; }, ", elm, ");" ]+ Range lo hi ->+ do lo' <- expression lo+ hi' <- expression hi+ return $ obj "_L.range" `call` [lo',hi'] -jsImport (modul, method) =- concat $ zipWith3 (\s n v -> s ++ assign' n v ++ ";") starters subnames values- where- starters = "\nvar " : repeat "\n"- values = map (\name -> name ++ " || {}") (init subnames) ++- ["Elm." ++ modul ++ parens "elm"]- subnames = map dotSep . tail . List.inits $ split modul+ Access e x ->+ do e' <- expression e+ return $ DotRef () e' (var x) - split names = case go [] names of- (name, []) -> [name]- (name, ns) -> name : split ns- go name str = case str of- '.':rest -> (reverse name, rest)- c:rest -> go (c:name) rest- [] -> (reverse name, [])+ Remove e x ->+ do e' <- expression e+ return $ obj "_N.remove" `call` [string x, e'] + Insert e x v ->+ do v' <- expression v+ e' <- expression e+ return $ obj "_N.insert" `call` [string x, v', e'] -class ToJS a where- toJS :: a -> Unique String+ Modify e fs ->+ do e' <- expression e+ fs' <- forM fs $ \(f,v) -> do+ v' <- expression v+ return $ ArrayLit () [string f, v']+ return $ obj "_N.replace" `call` [ArrayLit () fs', e'] + Record fields ->+ do fields' <- forM fields $ \(f,e) -> do+ (,) f <$> expression e+ let fieldMap = List.foldl' combine Map.empty fields'+ return $ ObjectLit () $ (PropId () (var "_"), hidden fieldMap) : visible fieldMap+ where+ combine r (k,v) = Map.insertWith (++) k [v] r+ prop = PropId () . var+ hidden fs = ObjectLit () . map (prop *** ArrayLit ()) .+ Map.toList . Map.filter (not . null) $ Map.map tail fs+ visible fs = map (first prop) . Map.toList $ Map.map head fs -instance ToJS (Def t v) where+ Binop op e1 e2 -> binop span op e1 e2 - -- TODO: Make this handle patterns besides plain variables- toJS (Def (PVar x) e)- | isOp x = globalAssign ("_op['" ++ x ++ "']") `liftM` toJS' e- | otherwise = assign (deprime x) `liftM` toJS' e+ Lambda p e@(L s _) ->+ do body' <- expression body+ return $ case length args < 2 || length args > 9 of+ True -> foldr (==>) body' (map (:[]) args)+ False -> ref ("F" ++ show (length args)) <| (args ==> body')+ where+ (args, body) = foldr depattern ([], innerBody) (zip patterns [0..]) - toJS (Def pattern e@(L s _)) =- do n <- guid- let x = "_" ++ show n- var = L s . Var- toDef y' = let y = deprime y' in- Def (PVar y) (L s $ Case (var x) [(pattern, var y)])- stmt <- assign x `liftM` toJS' e- vars <- toJS . map toDef . Set.toList $ SD.boundVars pattern- return (stmt ++ vars)+ depattern (pattern,n) (args, body) =+ case pattern of+ PVar x -> (args ++ [x], body)+ _ -> let arg = "arg" ++ show n+ in (args ++ [arg], L s (Case (L s (Var arg)) [(pattern, body)])) - toJS (TypeAnnotation _ _) = return ""+ (patterns, innerBody) = collect [p] e + collect patterns lexpr@(L _ expr) =+ case expr of+ Lambda p e -> collect (p:patterns) e+ _ -> (patterns, lexpr) -instance ToJS a => ToJS [a] where- toJS xs = concat `liftM` mapM toJS xs+ App e1 e2 ->+ do func' <- expression func+ args' <- mapM expression args+ return $ case args' of+ [arg] -> func' <| arg+ _ | length args' <= 9 -> ref aN `call` (func':args')+ | otherwise -> foldl1 (<|) (func':args')+ where+ aN = "A" ++ show (length args)+ (func, args) = getArgs e1 [e2]+ getArgs func args =+ case func of+ (L _ (App f arg)) -> getArgs f (arg : args)+ _ -> (func, args) -toJS' :: LExpr t v -> Unique String-toJS' (L span expr) =- case expr of- MultiIf ps -> multiIfToJS span ps- Case e cases -> caseToJS span e cases- _ -> toJS expr+ Let defs e ->+ do let (defs',e') = SD.flattenLets defs e + stmts <- concat <$> mapM definition defs'+ exp <- expression e'+ return $ function [] (stmts ++ [ ReturnStmt () (Just exp) ]) `call` [] -remove x e = "_N.remove('" ++ deprime x ++ "', " ++ e ++ ")"-addField x v e = "_N.insert('" ++ deprime x ++ "', " ++ v ++ ", " ++ e ++ ")"-setField fs e = "_N.replace(" ++ jsList (map f fs) ++ ", " ++ e ++ ")"- where f (x,v) = "['" ++ deprime x ++ "'," ++ v ++ "]"-access x e = e ++ "." ++ deprime x-makeRecord kvs = record `liftM` collect kvs- where- combine r (k,v) = Map.insertWith (++) k v r- collect = liftM (List.foldl' combine Map.empty) . mapM prep- prep (k, e) =- do v <- toJS' e- return (deprime k, [v])- fields fs =- brackets ("\n "++List.intercalate ",\n " (map (\(k,v) -> k++":"++v) fs))- hidden = fields . map (second jsList) .- filter (not . null . snd) . Map.toList . Map.map tail- record kvs = fields . (("_", hidden kvs) :) . Map.toList . Map.map head $ kvs+ MultiIf branches ->+ do branches' <- forM branches $ \(b,e) -> (,) <$> expression b <*> expression e+ return $ case last branches of+ (L _ (Var "Basics.otherwise"), e) -> ifs (init branches') (snd (last branches'))+ _ -> ifs branches'+ (obj "_E.If" `call` [ ref "$moduleName", string (show span) ])+ where+ ifs branches finally = foldr iff finally branches+ iff (if', then') else' = CondExpr () if' then' else' + Case e cases ->+ do (tempVar,initialMatch) <- Case.toMatch cases+ (revisedMatch, stmt) <-+ case e of+ L _ (Var x) -> return (Case.matchSubst [(tempVar,x)] initialMatch, [])+ _ -> do e' <- expression e+ return (initialMatch, [VarDeclStmt () [varDecl tempVar e']])+ match' <- match span revisedMatch+ return (function [] (stmt ++ match') `call` []) -instance ToJS Literal where- toJS lit =- case lit of- Chr c -> return $ quoted [c]- Str s -> return $ "_str" ++ parens (quoted s)- IntNum n -> return $ show n- FloatNum n -> return $ show n- Boolean b -> return $ if b then "true" else "false"+ ExplicitList es ->+ do es' <- mapM expression es+ return $ obj "_J.toList" <| ArrayLit () es' + Data name es ->+ do es' <- mapM expression es+ return $ ObjectLit () (ctor : fields es')+ where+ ctor = (prop "ctor", string (makeSafe name))+ fields = zipWith (\n e -> (prop ("_" ++ show n), e)) [0..] -instance ToJS (Expr t v) where- toJS expr =- case expr of- Var x -> return (deprime x)- Literal lit -> toJS lit- Range lo hi -> jsRange `liftM` toJS' lo `ap` toJS' hi- Access e x -> access x `liftM` toJS' e- Remove e x -> remove x `liftM` toJS' e- Insert e x v -> addField x `liftM` toJS' v `ap` toJS' e- Modify e fs -> do fs' <- (mapM (\(x,v) -> (,) x `liftM` toJS' v) fs)- setField fs' `liftM` toJS' e- Record fs -> makeRecord fs- Binop op e1 e2 -> binop op e1 e2+ Markdown doc _ -> return $ obj "Text.text" <| string (pad ++ md ++ pad)+ where pad = "<div style=\"height:0;width:0;\"> </div>"+ md = Pan.writeHtmlString Pan.def doc - Lambda p e@(L s _) -> liftM fastFunc (toJS' body)- where- fastFunc body- | length args < 2 || length args > 9 =- foldr (\arg bod -> jsFunc arg (ret bod)) body args- | otherwise =- "F" ++ show (length args) ++ parens (jsFunc (commaSep args) (ret body))+definition :: Def () () -> State Int [Statement ()]+definition def =+ case def of+ TypeAnnotation _ _ -> return [] - (args, body) = first reverse $ foldr depattern ([], innerBody) (zip patterns [1..])+ Def pattern expr@(L span _) -> do+ expr' <- expression expr+ let assign x = varDecl x expr'+ case pattern of+ PVar x+ | isOp x ->+ let op = LBracket () (ref "_op") (string x) in+ return [ ExprStmt () $ AssignExpr () OpAssign op expr' ]+ | otherwise ->+ return [ VarDeclStmt () [ assign x ] ] - depattern (pattern,n) (args, body) =- case pattern of- PVar x -> (deprime x : args, body)- _ -> let arg = "arg" ++ show n- in (arg:args, L s (Case (L s (Var arg)) [(pattern, body)]))+ PRecord fields ->+ let setField f = varDecl f (dotSep ["$",f]) in+ return [ VarDeclStmt () (assign "$" : map setField fields) ] - (patterns, innerBody) = collect [p] e+ PData name patterns | vars /= Nothing ->+ case vars of+ Just vs -> return [ VarDeclStmt () (setup (zipWith decl vs [0..])) ]+ where+ vars = getVars patterns+ getVars patterns =+ case patterns of+ PVar x : rest -> (x:) `fmap` getVars rest+ [] -> Just []+ _ -> Nothing - collect patterns lexpr@(L _ expr) =- case expr of- Lambda p e -> collect (p:patterns) e- _ -> (patterns, lexpr)+ decl x n = varDecl x (dotSep ["$","_" ++ show n])+ setup vars+ | isTuple name = assign "$" : vars+ | otherwise = safeAssign : vars - App e1 e2 -> jsApp e1 e2- Let defs e -> jsLet $ SD.flattenLets defs e + safeAssign = varDecl "$" (CondExpr () if' expr' exception)+ if' = InfixExpr () OpStrictEq (obj "$.ctor") (string name)+ exception = obj "_E.Case" `call` [ref "$moduleName", string (show span)] - ExplicitList es ->- do es' <- mapM toJS' es- return $ "_J.toList" ++ parens (jsList es')+ _ ->+ do defs' <- concat <$> mapM toDef vars+ return (VarDeclStmt () [assign "$"] : defs')+ where+ vars = Set.toList $ SD.boundVars pattern+ mkVar = L span . Var+ toDef y = definition $+ Def (PVar y) (L span $ Case (mkVar "$") [(pattern, mkVar y)]) - Data name es ->- do fs <- mapM toJS' es- return $ case name of- "[]" -> jsNil- "::" -> jsCons (head fs) ((head . tail) fs)- _ -> jsObj $ ("ctor:" ++ show name) : fields- where fields = zipWith (\n e -> "_" ++ show n ++ ":" ++ e) [0..] fs+match :: (Show a) => a -> Case.Match () () -> State Int [Statement ()]+match span mtch =+ case mtch of+ Case.Match name clauses mtch' ->+ do (isChars, clauses') <- unzip <$> mapM (clause span name) clauses+ mtch'' <- match span mtch'+ return (SwitchStmt () (format isChars (access name)) clauses' : mtch'')+ where+ isLiteral p = case p of+ Case.Clause (Right _) _ _ -> True+ _ -> False+ access name = if any isLiteral clauses then ref name else dotSep [name,"ctor"]+ format isChars e+ | or isChars = InfixExpr () OpAdd e (string "")+ | otherwise = e - Markdown doc -> return $ "Text.text('" ++ pad ++ md ++ pad ++ "')"- where pad = "<div style=\"height:0;width:0;\"> </div>"- md = formatMarkdown $ Pan.writeHtmlString Pan.def doc+ Case.Fail ->+ return [ ExprStmt () (obj "_E.Case" `call` [ref "$moduleName", string (show span)]) ] -jsApp e1 e2 =- do f <- toJS' func- as <- mapM toJS' args- return $ case as of- [a] -> f ++ parens a- _ -> "A" ++ show (length as) ++ parens (commaSep (f:as))+ Case.Break -> return [BreakStmt () Nothing]+ Case.Other e ->+ do e' <- expression e+ return [ ReturnStmt () (Just e') ]+ Case.Seq ms -> concat <$> mapM (match span) (dropEnd [] ms)+ where+ dropEnd acc [] = acc+ dropEnd acc (m:ms) =+ case m of+ Case.Other _ -> acc ++ [m]+ _ -> dropEnd (acc ++ [m]) ms++clause span variable (Case.Clause value vars mtch) =+ (,) isChar . CaseClause () pattern <$> match span (Case.matchSubst (zip vars vars') mtch) where- (func, args) = go [e2] e1- go args e =- case e of- (L _ (App e1 e2)) -> go (e2 : args) e1- _ -> (e, args)+ vars' = map (\n -> variable ++ "._" ++ show n) [0..]+ (isChar, pattern) =+ case value of+ Right (Chr c) -> (True, string [c])+ _ -> (,) False $ case value of+ Right (Boolean b) -> BoolLit () b+ Right lit -> literal lit+ Left name -> string $ case List.elemIndices '.' name of+ [] -> name+ is -> drop (last is + 1) name -formatMarkdown = concatMap f- where f '\'' = "\\'"- f '\n' = "\\n"- f '"' = "\""- f c = [c] -multiIfToJS span ps =- case last ps of- (L _ (Var "otherwise"), e) -> toJS' e >>= \b -> format b (init ps)- _ -> format ("_E.If" ++ parens ("$moduleName," ++ quoted (show span))) ps+jsModule :: MetadataModule () () -> String +jsModule modul =+ show . prettyPrint $ setup (Just "Elm") (names modul ++ ["make"]) +++ [ assign ("Elm" : names modul ++ ["make"]) (function ["elm"] programStmts) ] where- format base ps =- foldr (\c e -> parens $ c ++ " : " ++ e) base `liftM` mapM f ps- f (b,e) = do b' <- toJS' b- e' <- toJS' e- return (b' ++ " ? " ++ e')+ thisModule = dotSep ("elm" : names modul ++ ["values"])+ programStmts =+ concat [ setup (Just "elm") (names modul ++ ["values"])+ , [ IfSingleStmt () thisModule (ReturnStmt () (Just thisModule)) ]+ , [ internalImports (List.intercalate "." (names modul)) ]+ , concatMap jsImport (imports modul)+ , concatMap importEvent (foreignImports modul)+ , [ assign ["_op"] (ObjectLit () []) ]+ , concat $ evalState (mapM definition . fst . SD.flattenLets [] $ program modul) 0+ , map exportEvent $ foreignExports modul+ , [ jsExports ]+ , [ ReturnStmt () (Just thisModule) ]+ ] -jsLet (defs,e') = do ds <- mapM toJS defs- e <- toJS' e'- return $ jsFunc "" (concat ds ++ ret e) ++ "()"+ jsExports = assign ("elm" : names modul ++ ["values"]) (ObjectLit () exs)+ where+ exs = map entry . filter (not . isOp) $ "_op" : exports modul+ entry x = (PropId () (var x), ref x)+ + assign path expr =+ case path of+ [x] -> VarDeclStmt () [ varDecl x expr ]+ _ -> ExprStmt () $+ AssignExpr () OpAssign (LDot () (dotSep (init path)) (last path)) expr -caseToJS span e ps = do- (tempVar,match) <- caseToMatch ps- e' <- toJS' e- let (match',stmt) = case e of- L _ (Var x) -> (matchSubst [(tempVar,deprime x)] match, "")- _ -> (match, assign tempVar e')- matches <- matchToJS span match'- return $ jsFunc "" (stmt ++ matches) ++ "()"+ jsImport (modul,_) = setup Nothing path ++ [ include ]+ where+ path = split modul+ include = assign path $ dotSep ("Elm" : path ++ ["make"]) <| ref "elm" -matchToJS span match =- case match of- Match name clauses def ->- do cases <- concat `liftM` mapM (clauseToJS span name) clauses- finally <- matchToJS span def- let isLiteral p = case p of- Clause (Right _) _ _ -> True- _ -> False- access = if any isLiteral clauses then "" else ".ctor"- return $ concat [ "\nswitch (", name, access, ") {"- , indent cases, "\n}", finally ]- Fail -> return ("_E.Case" ++ parens ("$moduleName," ++ quoted (show span)))- Break -> return "break;"- Other e -> ret `liftM` toJS' e- Seq ms -> concat `liftM` mapM (matchToJS span) (dropEnd [] ms)+ setup namespace path = map create paths where- dropEnd acc [] = acc- dropEnd acc (m:ms) =- case m of- Other _ -> acc ++ [m]- _ -> dropEnd (acc ++ [m]) ms+ create name = assign name (InfixExpr () OpLOr (dotSep name) (ObjectLit () []))+ paths = case namespace of+ Nothing -> tail . init $ List.inits path+ Just nmspc -> drop 2 . init . List.inits $ nmspc : path -clauseToJS span var (Clause value vars e) = do- let vars' = map (\n -> var ++ "._" ++ show n) [0..]- s <- matchToJS span $ matchSubst (zip vars vars') e- return $ concat [ "\ncase ", case value of- Right (Boolean True) -> "true"- Right (Boolean False) -> "false"- Right lit -> show lit- Left name -> quoted $ case List.elemIndices '.' name of- [] -> name- is -> drop (last is + 1) name- , ":", indent s ]+ addId js = InfixExpr () OpAdd (string (js++"_")) (obj "elm.id") -jsNil = "_L.Nil"-jsCons e1 e2 = "_L.Cons(" ++ e1 ++ "," ++ e2 ++ ")"-jsRange e1 e2 = "_L.range" ++ parens (e1 ++ "," ++ e2)-jsCompare e1 e2 op = parens ("_N.cmp(" ++ e1 ++ "," ++ e2 ++ ")" ++ op)+ importEvent (js,base,elm,_) =+ [ VarDeclStmt () [ varDecl elm $ obj "Signal.constant" <| evalState (expression base) 0 ]+ , ExprStmt () $+ obj "document.addEventListener" `call`+ [ addId js+ , function ["e"]+ [ ExprStmt () $ obj "elm.notify" `call` [dotSep [elm,"id"], obj "e.value"] ]+ ]+ ] + exportEvent (js,elm,_) =+ ExprStmt () $+ ref "A2" `call`+ [ obj "Signal.lift"+ , function ["v"]+ [ VarDeclStmt () [varDecl "e" $ obj "document.createEvent" <| string "Event"]+ , ExprStmt () $+ obj "e.initEvent" `call` [ addId js, BoolLit () True, BoolLit () True ]+ , ExprStmt () $ AssignExpr () OpAssign (LDot () (ref "e") "value") (ref "v")+ , ExprStmt () $ obj "document.dispatchEvent" <| ref "e"+ , ReturnStmt () (Just $ ref "v")+ ]+ , ref elm ] -binop op e1 e2- | op == "Basics.." =- do ss <- mapM toJS' (e1 : collect [] e2)- return . jsFunc "$" . ret $ apply "$" ss- | op == "Basics.<|" =- do arg <- toJS' e2- funcs <- mapM toJS' (collect [] e1)- return (apply arg funcs)- | otherwise =- binopNormal op `liftM` toJS' e1 `ap` toJS' e2+binop span op e1 e2 =+ case op of+ "Basics.." ->+ do es <- mapM expression (e1 : collect [] e2)+ return $ ["$"] ==> foldr (<|) (ref "$") es+ "Basics.<|" ->+ do e2' <- expression e2+ es <- mapM expression (collect [] e1)+ return $ foldr (<|) e2' es+ "List.++" ->+ do e1' <- expression e1+ e2' <- expression e2+ return $ obj "_L.append" `call` [e1', e2']+ "::" -> expression (L span (Data "::" [e1,e2]))+ _ ->+ do e1' <- expression e1+ e2' <- expression e2+ return $ case Map.lookup op opDict of+ Just f -> f e1' e2'+ Nothing -> ref "A2" `call` [ func, e1', e2' ] where- apply = foldr (\f arg-> f ++ parens arg)- collect es e = case e of L _ (Binop op e1 e2) | op == "Basics.." -> collect (es ++ [e1]) e2 _ -> es ++ [e] -binopNormal op s1 s2 =- case Map.lookup op opDict of- Just e -> e- Nothing -> "A2" ++ parens (commaSep [ prefix ++ func, s1, s2 ])- where- func | isOp op' = "_op['" ++ op' ++ "']"- | otherwise = op'- (prefix, op') = case List.elemIndices '.' op of- [] -> ("", op)- xs -> splitAt (last xs + 1) op+ js1 = expression e1+ js2 = expression e2 - opDict = Map.fromList $ basics ++- [ ("::", jsCons s1 s2)- , ("List.++", "_L.append" ++ parens (s1 ++ "," ++ s2)) ]+ func | isOp operator = BracketRef () (dotSep (init parts ++ ["_op"])) (string operator)+ | otherwise = dotSep parts+ where+ parts = split op+ operator = last parts - ops = pow : map (\op -> (op, parens (s1 ++ op ++ s2))) ["+","-","*","/","&&","||"]- where pow = ("^" , "Math.pow(" ++ s1 ++ "," ++ s2 ++ ")")+ opDict = Map.fromList (infixOps ++ specialOps) - basics = ops ++ map (\(op,e) -> ("Basics." ++ op, e))- (ops ++ [ ("<|", s1 ++ parens s2)- , ("|>", s2 ++ parens s1)- , ("==", "_N.eq(" ++ s1 ++ "," ++ s2 ++ ")")- , ("/=", "!_N.eq(" ++ s1 ++ "," ++ s2 ++ ")")- , ("<" , jsCompare s1 s2 "<0")- , (">" , jsCompare s1 s2 ">0")- , ("<=", jsCompare s1 s2 "<1")- , (">=", jsCompare s1 s2 ">-1")- , ("div", parens (s1 ++ "/" ++ s2 ++ "|0"))- ])+ specialOp str func = [ (str, func), ("Basics." ++ str, func) ]+ infixOp str op = specialOp str (InfixExpr () op)++ infixOps = concat+ [ infixOp "+" OpAdd+ , infixOp "-" OpSub+ , infixOp "*" OpMul+ , infixOp "/" OpDiv+ , infixOp "&&" OpLAnd+ , infixOp "||" OpLOr+ ]++ specialOps = concat+ [ specialOp "^" $ \a b -> obj "Math.pow" `call` [a,b]+ , specialOp "|>" $ flip (<|)+ , specialOp "==" $ \a b -> obj "_N.eq" `call` [a,b]+ , specialOp "/=" $ \a b -> PrefixExpr () PrefixLNot (obj "_N.eq" `call` [a,b])+ , specialOp "<" $ cmp OpLT 0+ , specialOp ">" $ cmp OpGT 0+ , specialOp "<=" $ cmp OpLT 1+ , specialOp ">=" $ cmp OpGT (-1)+ , specialOp "div" $ \a b -> InfixExpr () OpBOr (InfixExpr () OpDiv a b) (IntLit () 0)+ ]++ cmp op n a b = InfixExpr () op (obj "_N.cmp" `call` [a,b]) (IntLit () n)
compiler/Generate/Noscript.hs view
@@ -49,7 +49,7 @@ Case e cases -> concatMap (f . snd) cases Data _ es -> concatMap f es MultiIf es -> concatMap (f . snd) es- Markdown doc -> [ Pan.writeHtmlString Pan.def doc ]+ Markdown doc _ -> [ Pan.writeHtmlString Pan.def doc ] _ -> [] extractLink src txt =
compiler/Initialize.hs view
@@ -6,12 +6,13 @@ import qualified Data.List as List import qualified Data.Map as Map import qualified Data.Set as Set+import System.Directory import System.Exit import System.FilePath as FP import Text.PrettyPrint (Doc) import SourceSyntax.Everything-import SourceSyntax.Type+import qualified SourceSyntax.Type as Type import qualified Parse.Parse as Parse import qualified Metadata.Prelude as Prelude import qualified Transform.Check as Check@@ -23,8 +24,11 @@ buildFromSource :: Bool -> Interfaces -> String -> Either [Doc] (MetadataModule () ()) buildFromSource noPrelude interfaces source = do let add = if noPrelude then id else Prelude.add- modul@(Module _ _ _ decls') <- add `fmap` Parse.program source+ infixes = Map.fromList . map (\(assoc,lvl,op) -> (op,(lvl,assoc)))+ . concatMap iFixities $ Map.elems interfaces + modul@(Module _ _ _ decls') <- add `fmap` Parse.program infixes source+ -- check for structural errors Module names exs ims decls <- case Check.mistakes decls' of@@ -35,7 +39,8 @@ | null exs = let get = Set.toList . SD.boundVars in concat [ get pattern | Definition (Def pattern _) <- decls ] ++- concat [ map fst ctors | Datatype _ _ ctors <- decls ]+ concat [ map fst ctors | Datatype _ _ ctors <- decls ] +++ [ name | TypeAlias name _ (Type.Record _ _) <- decls ] | otherwise = exs metaModule <- Canonical.metadataModule interfaces $ MetadataModule {@@ -58,9 +63,9 @@ return $ metaModule { types = types } -getSortedDependencies :: Bool -> FilePath -> IO [String]-getSortedDependencies noPrelude root =- sortDeps =<< readDeps noPrelude root+getSortedDependencies :: [FilePath] -> Bool -> FilePath -> IO [String]+getSortedDependencies srcDirs noPrelude root =+ sortDeps =<< readDeps srcDirs noPrelude root type Deps = (FilePath, String, [String]) @@ -75,18 +80,18 @@ mistakes = filter (\scc -> length scc > 1) sccs msg = "A cyclical module dependency or was detected in: " -readDeps :: Bool -> FilePath -> IO [Deps]-readDeps noPrelude root = evalStateT (go root) Set.empty+readDeps :: [FilePath] -> Bool -> FilePath -> IO [Deps]+readDeps srcDirs noPrelude root = evalStateT (go root) Set.empty where builtIns = if noPrelude then Set.empty else Set.fromList (Map.keys Prelude.interfaces) go :: FilePath -> StateT (Set.Set String) IO [Deps] go root = do- txt <- liftIO $ readFile root+ (root', txt) <- liftIO $ getFile srcDirs root case Parse.dependencies txt of Left err -> liftIO (putStrLn msg >> print err >> exitFailure)- where msg = "Error resolving dependencies in " ++ root ++ ":"+ where msg = "Error resolving dependencies in " ++ root' ++ ":" Right (name,deps) -> do seen <- get@@ -94,8 +99,21 @@ newDeps = Set.difference (Set.filter (not . isNative) realDeps) seen put (Set.insert name (Set.union newDeps seen)) rest <- mapM (go . toFilePath) (Set.toList newDeps)- return ((makeRelative "." root, name, Set.toList realDeps) : concat rest)- + return ((makeRelative "." root', name, Set.toList realDeps) : concat rest)++getFile :: [FilePath] -> FilePath -> IO (FilePath,String)+getFile [] path = do+ putStrLn $ unlines [ "Could not find file: " ++ path+ , " If it is not in the root directory of your project, use"+ , " --src-dir to declare additional locations for source files." ]+ exitFailure++getFile (dir:dirs) path = do+ let path' = dir </> path+ exists <- doesFileExist path'+ case exists of+ True -> (,) path' `fmap` readFile path'+ False -> getFile dirs path isNative name = List.isPrefixOf "Native." name
compiler/Language/Elm.hs view
@@ -1,17 +1,16 @@-{- | This module exports the functions necessary for compiling Elm code into the - respective HTML, CSS, and JS code. +{- | This module exports the functions necessary for compiling Elm to JS, + and some utilities for making it easier to find some Elm-related files. The documentation for the Elm language is available at <http://elm-lang.org/Documentation.elm>, and many interactive examples are available at <http://elm-lang.org/Examples.elm> -} -module Language.Elm (compile, moduleName, runtime) where +module Language.Elm (compile, moduleName, runtime, docs) where import qualified Data.List as List import qualified Data.Map as Map import Data.Version (showVersion) import Generate.JavaScript (jsModule) -import Generate.Html (generateHtml) import Initialize (buildFromSource) import Parse.Module (getModuleName) import SourceSyntax.Module @@ -31,13 +30,6 @@ -- |This function extracts the module name of a given source program. moduleName :: String -> Maybe String moduleName = getModuleName - --- |This function compiles Elm code into a full HTML page. -toHtml :: String -- ^ Location of elm-min.js as expected by the browser - -> String -- ^ The page title - -> String -- ^ The elm source code - -> Html -toHtml = generateHtml -- |The absolute path to Elm's runtime system. runtime :: IO FilePath
compiler/Parse/Binop.hs view
@@ -1,4 +1,4 @@-module Parse.Binop (binops, infixStmt, OpTable) where+module Parse.Binop (binops, OpTable) where import Control.Applicative ((<$>)) import Control.Monad.Error@@ -11,42 +11,23 @@ import Text.Parsec import Parse.Helpers -type OpTable = [(Int, Assoc, String)]--preludeTable :: OpTable-preludeTable =- [ (9, R, ".")- , (8, R, "^")- , (7, L, "*"), (7, L, "/"), (7, L, "mod"), (7, L, "div"), (7, L, "rem")- , (6, L, "+"), (6, L, "-")- , (5, R, "::"), (5, R, "++")- , (4, N, "<="), (4, N, ">="), (4, N, "<")- , (4, N, "=="), (4, N, "/="), (4, N, ">")- , (4, L, "~"), (4, L, "<~")- , (3, R, "&&")- , (2, R, "||")- , (0, R, "<|"), (0, L, "|>")- ]- opLevel :: OpTable -> String -> Int-opLevel table op = Map.findWithDefault 9 op dict- where dict = Map.fromList (map (\(lvl,_,op) -> (op,lvl)) table)+opLevel table op = fst $ Map.findWithDefault (9,L) op table opAssoc :: OpTable -> String -> Assoc-opAssoc table op = Map.findWithDefault R op dict- where dict = Map.fromList (map (\(_,assoc,op) -> (op,assoc)) table)+opAssoc table op = snd $ Map.findWithDefault (9,L) op table hasLevel :: OpTable -> Int -> (String, LExpr t v) -> Bool hasLevel table n (op,_) = opLevel table op == n -binops :: OpTable- -> IParser (LExpr t v)+binops :: IParser (LExpr t v) -> IParser (LExpr t v) -> IParser String -> IParser (LExpr t v)-binops table term last anyOp =+binops term last anyOp = do e <- term- split (table ++ preludeTable) 0 e =<< nextOps+ table <- getState+ split table 0 e =<< nextOps where nextOps = choice [ commitIf (whitespace >> anyOp) $ do whitespace ; op <- anyOp ; whitespace@@ -80,32 +61,24 @@ joinL :: [LExpr t v] -> [String] -> IParser (LExpr t v) joinL [e] [] = return e joinL (a:b:es) (op:ops) = joinL (merge a b (Binop op a b) : es) ops-joinL _ _ = fail "Ill-formed binary expression. Report a compiler bug."+joinL _ _ = failure "Ill-formed binary expression. Report a compiler bug." joinR :: [LExpr t v] -> [String] -> IParser (LExpr t v) joinR [e] [] = return e joinR (a:b:es) (op:ops) = do e <- joinR (b:es) ops return (merge a e (Binop op a e))-joinR _ _ = fail "Ill-formed binary expression. Report a compiler bug."+joinR _ _ = failure "Ill-formed binary expression. Report a compiler bug." getAssoc :: OpTable -> Int -> [(String,LExpr t v)] -> IParser Assoc getAssoc table n eops | all (==L) assocs = return L | all (==R) assocs = return R | all (==N) assocs = case assocs of [_] -> return N- _ -> fail msg+ _ -> failure (msg "precedence")+ | otherwise = failure (msg "associativity") where levelOps = filter (hasLevel table n) eops assocs = map (opAssoc table . fst) levelOps- msg = concat [ "Conflicting precedence for binary operators ("- , intercalate ", " (map fst eops), "). "- , "Consider adding parentheses to disambiguate." ]--infixStmt :: IParser (Int, Assoc, String)-infixStmt =- let infx str assoc = try (reserved ("infix" ++ str) >> return assoc) in- do assoc <- choice [ infx "l" L, infx "r" R, infx "" N ]- whitespace- prec <- do n <- digit ; return (read [n] :: Int)- whitespace- op <- anyOp- return (prec, assoc, op)+ msg problem =+ concat [ "Conflicting " ++ problem ++ " for binary operators ("+ , intercalate ", " (map fst eops), "). "+ , "Consider adding parentheses to disambiguate." ]
compiler/Parse/Declaration.hs view
@@ -3,6 +3,7 @@ import Control.Applicative ((<$>), (<*>)) import qualified Data.List as List+import qualified Data.Set as Set import Text.Parsec hiding (newline,spaces) import Text.Parsec.Indent import qualified Text.Pandoc as Pan@@ -13,7 +14,6 @@ import qualified Parse.Type as Type import SourceSyntax.Declaration (Declaration(..), Assoc(..)) -import Unique declaration :: IParser (Declaration t v) declaration = alias <|> datatype <|> infixDecl <|> foreignDef <|> definition@@ -71,8 +71,8 @@ T.Data "Signal" [t] -> case isExportable t of Nothing -> return (ExportEvent eventName elmVar tipe)- Just err -> error err- _ -> error "When importing foreign events, the imported value must have type Signal."+ Just err -> fail err+ _ -> fail "When importing foreign events, the imported value must have type Signal." importEvent :: IParser (Declaration t v) importEvent = do@@ -88,29 +88,15 @@ T.Data "Signal" [t] -> case isExportable t of Nothing -> return (ImportEvent eventName baseValue elmVar tipe)- Just err -> error err- _ -> error "When importing foreign events, the imported value must have type Signal."+ Just err -> fail err+ _ -> fail "When importing foreign events, the imported value must have type Signal." jsVar :: IParser String jsVar = betwixt '"' '"' $ do v <- (:) <$> (letter <|> char '_') <*> many (alphaNum <|> char '_')- if v `notElem` jsReserveds then return v else- error $ "'" ++ v +++ if Set.notMember v jsReserveds then return v else+ fail $ "'" ++ v ++ "' is not a good name for a importing or exporting JS values."--jsReserveds :: [String]-jsReserveds =- [ "null", "undefined", "Nan", "Infinity", "true", "false", "eval"- , "arguments", "int", "byte", "char", "goto", "long", "final", "float"- , "short", "double", "native", "throws", "boolean", "abstract", "volatile"- , "transient", "synchronized", "function", "break", "case", "catch"- , "continue", "debugger", "default", "delete", "do", "else", "finally"- , "for", "function", "if", "in", "instanceof", "new", "return", "switch"- , "this", "throw", "try", "typeof", "var", "void", "while", "with", "class"- , "const", "enum", "export", "extends", "import", "super", "implements"- , "interface", "let", "package", "private", "protected", "public"- , "static", "yield"- ] isExportable tipe = case tipe of
compiler/Parse/Expression.hs view
@@ -1,5 +1,6 @@-module Parse.Expression (def,term) where+module Parse.Expression (def,term,typeAnnotation) where +import Control.Arrow ((***)) import Control.Applicative ((<$>), (<*>)) import Data.List (foldl') import Text.Parsec hiding (newline,spaces)@@ -18,9 +19,7 @@ import SourceSyntax.Expression import SourceSyntax.Declaration (Declaration(Definition)) -import Unique - -------- Basic Terms -------- varTerm :: IParser (Expr t v)@@ -33,17 +32,14 @@ accessor :: IParser (Expr t v) accessor = do- start <- getPosition- lbl <- try (string "." >> rLabel)- end <- getPosition+ (start, lbl, end) <- located (try (string "." >> rLabel)) let loc e = Location.at start end e return (Lambda (PVar "_") (loc $ Access (loc $ Var "_") lbl)) negative :: IParser (Expr t v) negative = do- start <- getPosition- nTerm <- try (char '-' >> notFollowedBy (char '.' <|> char '-')) >> term- end <- getPosition+ (start, nTerm, end) <-+ located (try (char '-' >> notFollowedBy (char '.' <|> char '-')) >> term) let loc e = Location.at start end e return (Binop "-" (loc $ Literal (Literal.IntNum 0)) nTerm) @@ -51,43 +47,51 @@ -------- Complex Terms -------- listTerm :: IParser (Expr t v)-listTerm =- (do { try $ string "[markdown|"- ; md <- filter (/='\r') <$> manyTill anyChar (try $ string "|]")- ; return . Markdown $ Pan.readMarkdown Pan.def md })- <|> (braces $ choice- [ try $ do { lo <- expr; whitespace; string ".." ; whitespace- ; Range lo <$> expr }- , ExplicitList <$> commaSep expr- ])+listTerm = markdown' <|> braces (try range <|> ExplicitList <$> commaSep expr)+ where+ range = do+ lo <- expr+ whitespace >> string ".." >> whitespace+ Range lo <$> expr + markdown' = do+ (rawText, exprs) <- markdown interpolation+ let md = Pan.readMarkdown Pan.def (filter (/='\r') rawText)+ return (Markdown md exprs)++ span xs = "<span id=\"md" ++ show (length xs) +++ "\" style=\"font-family:monospace;\">{{ ... }}</span>"++ interpolation md exprs = do+ try (string "{{")+ whitespace+ e <- expr+ whitespace+ string "}}"+ return (md ++ span exprs, exprs ++ [e])+ parensTerm :: IParser (LExpr t v) parensTerm = try (parens opFn) <|> parens (tupleFn <|> parened) where opFn = do- start <- getPosition- op <- anyOp- end <- getPosition+ (start, op, end) <- located anyOp let loc = Location.at start end return . loc . Lambda (PVar "x") . loc . Lambda (PVar "y") . loc $ Binop op (loc $ Var "x") (loc $ Var "y") tupleFn = do- start <- getPosition let comma = char ',' <?> "comma ','"- commas <- comma >> many (whitespace >> comma)- end <- getPosition+ (start, commas, end) <- located (comma >> many (whitespace >> comma)) let vars = map (('v':) . show) [ 0 .. length commas + 1 ] loc = Location.at start end return $ foldr (\x e -> loc $ Lambda x e) (loc . tuple $ map (loc . Var) vars) (map PVar vars) parened = do- start <- getPosition- es <- commaSep expr- end <- getPosition- return $ case es of [e] -> e- _ -> Location.at start end (tuple es)+ (start, es, end) <- located (commaSep expr)+ return $ case es of+ [e] -> e+ _ -> Location.at start end (tuple es) recordTerm :: IParser (LExpr t v) recordTerm = brackets $ choice [ misc, addLocation record ]@@ -144,7 +148,7 @@ -------- Normal Expressions -------- binaryExpr :: IParser (LExpr t v)-binaryExpr = binops [] appExpr lastExpr anyOp+binaryExpr = binops appExpr lastExpr anyOp where lastExpr = addLocation (choice [ ifExpr, letExpr, caseExpr ]) <|> lambdaExpr @@ -196,7 +200,8 @@ <|> binaryExpr <?> "an expression" -funcDef =+defStart :: IParser [Pattern]+defStart = choice [ do p1 <- try Pattern.term infics p1 <|> func p1 , func =<< (PVar <$> parens symOp)@@ -219,24 +224,20 @@ makeFunction args body@(L s _) = foldr (\arg body' -> L s $ Lambda arg body') body args -assignExpr :: IParser (Def t v)-assignExpr = withPos $ do- (name:args) <- funcDef+definition :: IParser (Def t v)+definition = withPos $ do+ (name:args) <- defStart whitespace >> string "=" >> whitespace body <- expr return . Def name $ makeFunction args body typeAnnotation :: IParser (Def t v) typeAnnotation = TypeAnnotation <$> try start <*> Type.expr- where- start = do v <- lowVar <|> parens symOp- whitespace ; hasType ; whitespace- return v+ where+ start = do+ v <- lowVar <|> parens symOp+ whitespace ; hasType ; whitespace+ return v def :: IParser (Def t v)-def = typeAnnotation <|> assignExpr--attempt f parser str =- case iParse parser "" str of- Right result -> f result- Left err -> error $ "Parse error at " ++ show err+def = typeAnnotation <|> definition
compiler/Parse/Helpers.hs view
@@ -1,12 +1,17 @@ module Parse.Helpers where +import Prelude hiding (until) import Control.Applicative ((<$>),(<*>)) import Control.Monad import Control.Monad.State import Data.Char (isUpper)+import qualified Data.Set as Set+import qualified Data.Map as Map import SourceSyntax.Helpers as Help import SourceSyntax.Location as Location import SourceSyntax.Expression+import SourceSyntax.PrettyPrint+import SourceSyntax.Declaration (Assoc) import Text.Parsec hiding (newline,spaces,State) import Text.Parsec.Indent @@ -18,14 +23,32 @@ , "import", "as", "hiding", "open" , "export", "foreign" ] +jsReserveds :: Set.Set String+jsReserveds = Set.fromList+ [ "null", "undefined", "Nan", "Infinity", "true", "false", "eval"+ , "arguments", "int", "byte", "char", "goto", "long", "final", "float"+ , "short", "double", "native", "throws", "boolean", "abstract", "volatile"+ , "transient", "synchronized", "function", "break", "case", "catch"+ , "continue", "debugger", "default", "delete", "do", "else", "finally"+ , "for", "function", "if", "in", "instanceof", "new", "return", "switch"+ , "this", "throw", "try", "typeof", "var", "void", "while", "with", "class"+ , "const", "enum", "export", "extends", "import", "super", "implements"+ , "interface", "let", "package", "private", "protected", "public"+ , "static", "yield"+ ]+ expecting = flip (<?>) -type IParser a = ParsecT String () (State SourcePos) a+type OpTable = Map.Map String (Int, Assoc)+type IParser a = ParsecT String OpTable (State SourcePos) a -iParse :: IParser a -> SourceName -> String -> Either ParseError a-iParse aParser source_name input =- runIndent source_name $ runParserT aParser () source_name input+iParse :: IParser a -> String -> Either ParseError a+iParse = iParseWithTable "" Map.empty +iParseWithTable :: SourceName -> OpTable -> IParser a -> String -> Either ParseError a+iParseWithTable sourceName table aParser input =+ runIndent sourceName $ runParserT aParser table sourceName input+ backslashed :: IParser Char backslashed = do { char '\\'; c <- anyChar ; return . read $ ['\'','\\',c,'\''] }@@ -110,12 +133,21 @@ spacePrefix p = constrainedSpacePrefix p (\_ -> return ()) constrainedSpacePrefix p constraint =- many . try $ do- n <- whitespace- constraint n- indented- p+ many $ choice [ try (spacing >> lookAhead (oneOf "[({")) >> p+ , try (spacing >> p)+ ]+ where+ spacing = do+ n <- whitespace+ constraint n+ indented +failure msg = do+ inp <- getInput+ setInput ('x':inp)+ anyToken+ fail msg+ followedBy a b = do x <- a ; b ; return x betwixt a b c = do char a ; out <- c@@ -135,12 +167,17 @@ brackets :: IParser a -> IParser a brackets = surround '{' '}' "bracket" -addLocation :: IParser (Expr t v) -> IParser (LExpr t v)+addLocation :: (Pretty a) => IParser a -> IParser (Location.Located a) addLocation expr = do+ (start, e, end) <- located expr+ return (Location.at start end e)++located :: IParser a -> IParser (SourcePos, a, SourcePos)+located p = do start <- getPosition- e <- expr+ e <- p end <- getPosition- return (Location.at start end e)+ return (start, e, end) accessible :: IParser (LExpr t v) -> IParser (LExpr t v) accessible expr = do@@ -188,16 +225,74 @@ lineComment :: IParser String lineComment = do try (string "--")- comment <- manyTill anyChar $ simpleNewline <|> (eof >> return "\n")+ comment <- anyUntil $ simpleNewline <|> (eof >> return "\n") return ("--" ++ comment) multiComment :: IParser String-multiComment = do { try (string "{-"); closeComment }+multiComment = (++) <$> try (string "{-") <*> closeComment closeComment :: IParser String-closeComment = do- comment <- manyTill anyChar . choice $- [ try (string "-}") <?> "close comment"- , do { try $ string "{-"; closeComment; closeComment }- ]- return ("{-" ++ comment ++ "-}")+closeComment =+ anyUntil . choice $+ [ try (string "-}") <?> "close comment"+ , concat <$> sequence [ try (string "{-"), closeComment, closeComment ]+ ]++until :: IParser a -> IParser b -> IParser b+until p end = go+ where+ go = end <|> (p >> go)++anyUntil :: IParser String -> IParser String+anyUntil end = go+ where+ go = end <|> (:) <$> anyChar <*> go++ignoreUntil :: IParser a -> IParser (Maybe a)+ignoreUntil end = go+ where+ ignore p = const () <$> p+ filler = choice [ ignore multiComment+ , ignore (markdown (\_ _ -> mzero))+ , ignore anyChar+ ]+ go = choice [ Just <$> end+ , filler `until` choice [ const Nothing <$> eof, newline >> go ]+ ]++onFreshLines :: (a -> b -> b) -> b -> IParser a -> IParser b+onFreshLines insert init thing = go init+ where+ go values = do+ optionValue <- ignoreUntil thing+ case optionValue of+ Nothing -> return values+ Just v -> go (insert v values)++withSource :: IParser a -> IParser (String, a)+withSource p = do+ start <- getParserState+ result <- p+ endPos <- getPosition+ setParserState start+ raw <- anyUntilPos endPos+ return (raw, result)++anyUntilPos :: SourcePos -> IParser String+anyUntilPos pos = go+ where+ go = do currentPos <- getPosition+ case currentPos == pos of+ True -> return []+ False -> (:) <$> anyChar <*> go++markdown :: (String -> [a] -> IParser (String, [a])) -> IParser (String, [a])+markdown interpolation = try (string "[markdown|") >> closeMarkdown "" []+ where+ closeMarkdown md stuff =+ choice [ do try (string "|]")+ return (md, stuff)+ , uncurry closeMarkdown =<< interpolation md stuff+ , do c <- anyChar+ closeMarkdown (md ++ [c]) stuff+ ]
compiler/Parse/Literal.hs view
@@ -14,10 +14,13 @@ num = fmap toLit (preNum <?> "number") where toLit n | '.' `elem` n = FloatNum (read n) | otherwise = IntNum (read n)- preNum = (++) <$> many1 digit <*> option "" postNum+ preNum = concat <$> sequence [ option "" minus, many1 digit, option "" postNum ] postNum = do try $ lookAhead (string "." >> digit) string "." ('.':) <$> many1 digit+ minus = try $ do string "-"+ lookAhead digit+ return "-" chr :: IParser Literal chr = Chr <$> betwixt '\'' '\'' (backslashed <|> satisfy (/='\''))
compiler/Parse/Module.hs view
@@ -13,7 +13,7 @@ getModuleName :: String -> Maybe String getModuleName source =- case iParse getModuleName "" source of+ case iParse getModuleName source of Right name -> Just name Left _ -> Nothing where
compiler/Parse/Parse.hs view
@@ -4,13 +4,16 @@ import Control.Monad import Data.Char (isSymbol, isDigit) import Data.List (foldl',intercalate)+import qualified Data.Map as Map import Text.Parsec hiding (newline,spaces) import qualified Text.PrettyPrint as P import qualified SourceSyntax.Module as S+import SourceSyntax.Declaration (Declaration(Fixity)) import Parse.Helpers-import Parse.Binop (infixStmt, OpTable)+import Parse.Binop (OpTable) import Parse.Expression+import Parse.Declaration (infixDecl) import Parse.Type import Parse.Module import qualified Parse.Declaration as Decl@@ -22,8 +25,8 @@ decls = do d <- Decl.declaration <?> "at least one datatype or variable definition" (d:) <$> many freshDef -program :: String -> Either [P.Doc] (S.Module t v)-program = setupParser $ do+program :: OpTable -> String -> Either [P.Doc] (S.Module t v)+program table = setupParserWithTable table $ do optional freshLine (names,exports) <- option (["Main"],[]) (moduleDef `followedBy` freshLine) is <- (do try (lookAhead $ reserved "import")@@ -40,8 +43,28 @@ (,) <$> option "Main" (getName <$> moduleDef `followedBy` freshLine) <*> option [] (map fst <$> imports `followedBy` freshLine) +setupParserWithTable :: OpTable -> IParser a -> String -> Either [P.Doc] a+setupParserWithTable table p source =+ do localTable <- setupParser parseFixities source+ case Map.intersection table localTable of+ overlap | not (Map.null overlap) -> Left [ msg overlap ]+ | otherwise -> + flip setupParser source $ do+ putState (Map.union table localTable)+ p+ where+ msg overlap =+ P.vcat [ P.text "Parse error:"+ , P.text $ "Overlapping definitions for infix operators: " +++ intercalate " " (Map.keys overlap)+ ]++parseFixities = do+ decls <- onFreshLines (:) [] infixDecl+ return $ Map.fromList [ (op,(lvl,assoc)) | Fixity assoc lvl op <- decls ]+ setupParser :: IParser a -> String -> Either [P.Doc] a setupParser p source =- case iParse p "" source of+ case iParse p source of Right result -> Right result Left err -> Left [ P.text $ "Parse error at " ++ show err ]
compiler/Parse/Pattern.hs view
@@ -6,7 +6,6 @@ import Control.Monad.State import Data.Char (isUpper) import Data.List (intercalate)-import Unique import Text.Parsec hiding (newline,spaces,State) import Text.Parsec.Indent @@ -24,11 +23,7 @@ "True" -> PLiteral (Boolean True) "False" -> PLiteral (Boolean False) c : _ -> if isUpper c then PData v [] else PVar v- , do lit <- literal- return $ case lit of- Str s -> foldr combine (PData "[]" []) s- where combine h t = PData "::" [PLiteral (Chr h),t]- _ -> PLiteral lit+ , PLiteral <$> literal ] asPattern :: Pattern -> IParser Pattern@@ -64,71 +59,3 @@ expr = do patterns <- consSep1 (patternConstructor <|> term) asPattern (foldr1 Pattern.cons patterns) <?> "pattern"--{---extract :: Pattern -> LExpr t v -> Unique (String, LExpr t v)-extract pattern body@(L t s _) =- let loc = L t s in- let fn x e = (x,e) in- case pattern of- PAnything -> return $ fn "_" body- PVar x -> return $ fn x body- PAlias x PAnything -> return $ fn x body- PAlias x p -> do- (x', body') <- extract p body- return $ fn x (loc $ Let [FnDef x' [] (loc $ Var x)] body')- PData name ps -> do- x <- guid- let a = '_' : show x- return . fn a . loc $ Case (loc (Var a)) [(pattern, body)]- PRecord fs -> do- x <- guid- let a = '_' : show x- toDef f = FnDef f [] (loc $ Access (loc $ Var a) f)- return . fn a . loc $ Let (map toDef fs) body--extracts :: [Pattern] -> LExpr t v -> Unique ([String], LExpr t v)-extracts ps body = go [] (reverse ps) body- where go args [] body = return (args, body)- go args (p:ps) body = do (x,e) <- extract p body- go (x:args) ps e--flatten :: [Pattern] -> LExpr t v -> Unique (IParser [Def t v])-flatten patterns exp@(L t s _) =- let loc = L t s in- case patterns of- PVar f : args -> do- (as,e) <- extracts args exp- return . return $- if isOp (head f) then let [a,b] = as in [ OpDef f a b e ]- else [ FnDef f as e ]-- [p] -> return `liftM` matchSingle p exp p-- _ -> return . fail $ "Pattern (" ++ unwords (map show patterns) ++- ") cannot be used on the left-hand side of an assign statement."--matchSingle :: Pattern -> LExpr t v -> Pattern -> Unique [Def t v]-matchSingle pat exp@(L t s _) p =- let loc = L t s in- case p of- PData _ ps -> do- x <- guid- let v = '_' : show x- dss <- mapM (matchSingle pat . loc $ Var v) ps- return (FnDef v [] exp : concat dss)-- PVar x ->- return [ FnDef x [] (loc $ Case exp [(pat, loc $ Var x)]) ]-- PAlias x p' -> do- subPat <- matchSingle p' (loc $ Var x) p'- return $ (FnDef x [] (loc $ Case exp [(pat, loc $ Var x)])):subPat- - PRecord fs -> do- a <- (\x -> '_' : show x) `liftM` guid- let toDef f = FnDef f [] (loc $ Access (loc $ Var a) f)- return (FnDef a [] exp : map toDef fs)-- PAnything -> return []---}
compiler/Parse/Type.hs view
@@ -9,7 +9,6 @@ import SourceSyntax.Type as T import Parse.Helpers-import Unique tvar :: IParser T.Type tvar = T.Var <$> lowVar <?> "type variable"@@ -26,20 +25,23 @@ record :: IParser T.Type record = do char '{' ; whitespace- ext <- extend- fs <- fields+ (ext,fs) <- extended <|> normal dumbWhitespace ; char '}' return (T.Record fs ext) where- extend = option T.EmptyRecord . try $ do- t <- tvar- whitespace >> string "|" >> whitespace- return t- fields = commaSep $ do- lbl <- rLabel- whitespace >> hasType >> whitespace- (,) lbl <$> expr+ normal = (,) T.EmptyRecord <$> commaSep fields + -- extended record types require at least one field+ extended = do+ ext <- try (const <$> tvar <*> (whitespace >> string "|"))+ whitespace+ (,) ext <$> commaSep1 fields++ fields = do+ lbl <- rLabel+ whitespace >> hasType >> whitespace+ (,) lbl <$> expr+ capTypeVar = intercalate "." <$> dotSep1 capVar constructor0 :: IParser T.Type@@ -63,19 +65,11 @@ expr :: IParser T.Type expr = do t1 <- app <|> term- whitespace- arr <- optionMaybe arrow- whitespace+ arr <- optionMaybe $ try (whitespace >> arrow) case arr of- Just _ -> T.Lambda t1 <$> expr+ Just _ -> T.Lambda t1 <$> (whitespace >> expr) Nothing -> return t1 constructor :: IParser (String, [T.Type]) constructor = (,) <$> (capTypeVar <?> "another type constructor") <*> spacePrefix term--readType :: String -> Type-readType str =- case iParse expr "" str of- Left err -> error (show err)- Right tipe -> tipe
compiler/SourceSyntax/Declaration.hs view
@@ -4,6 +4,8 @@ import Data.Data import qualified SourceSyntax.Expression as Expr import SourceSyntax.Type+import SourceSyntax.PrettyPrint+import Text.PrettyPrint as P data Declaration tipe var = Definition (Expr.Def tipe var)@@ -15,4 +17,32 @@ deriving (Eq, Show) data Assoc = L | N | R- deriving (Eq, Show)+ deriving (Eq)++instance Show Assoc where+ show assoc =+ case assoc of+ L -> "left"+ N -> "non"+ R -> "right"++instance Pretty (Declaration t v) where+ pretty decl =+ case decl of+ Definition def -> pretty def++ Datatype tipe tvars ctors ->+ P.hang (P.text "data" <+> P.text tipe <+> P.hsep (map P.text tvars)) 4+ (P.sep $ zipWith join ("=" : repeat "|") ctors)+ where+ join c ctor = P.text c <+> prettyCtor ctor+ prettyCtor (name, tipes) =+ P.hang (P.text name) 2 (P.sep (map prettyParens tipes))++ TypeAlias name tvars tipe ->+ let alias = P.text name <+> P.hsep (map P.text tvars) in+ P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe)++ -- TODO: actually write out the other cases. They are currently unused, but+ -- this is probably going to be a bug someday.+ _ -> P.text (show decl)
compiler/SourceSyntax/Expression.hs view
@@ -30,7 +30,7 @@ | Insert (LExpr t v) String (LExpr t v) | Modify (LExpr t v) [(String, LExpr t v)] | Record [(String, LExpr t v)]- | Markdown Pandoc.Pandoc+ | Markdown Pandoc.Pandoc [LExpr t v] deriving (Eq, Show, Data, Typeable) data Def tipe var@@ -55,6 +55,8 @@ Var x -> variable x Range e1 e2 -> P.brackets (pretty e1 <> P.text ".." <> pretty e2) ExplicitList es -> P.brackets (commaCat (map pretty es))+ Binop "-" (Location.L _ (Literal (Literal.IntNum 0))) e ->+ P.text "-" <> prettyParens e Binop op e1 e2 -> P.sep [ prettyParens e1 <+> P.text op', prettyParens e2 ] where op' = if Help.isOp op then op else "`" ++ op ++ "`" Lambda p e -> let (ps,body) = collectLambdas (Location.none $ Lambda p e)@@ -75,26 +77,26 @@ Data "::" [hd,tl] -> pretty hd <+> P.text "::" <+> pretty tl Data "[]" [] -> P.text "[]" Data name es -> P.hang (P.text name) 2 (P.sep (map prettyParens es))- Access e x -> prettyParens e <> P.text "." <> P.text x- Remove e x -> P.braces (pretty e <+> P.text "-" <+> P.text x)+ Access e x -> prettyParens e <> P.text "." <> variable x+ Remove e x -> P.braces (pretty e <+> P.text "-" <+> variable x) Insert (Location.L _ (Remove e y)) x v ->- P.braces (pretty e <+> P.text "-" <+> P.text y <+> P.text "|" <+> P.text x <+> P.text "=" <+> pretty v)+ P.braces (pretty e <+> P.text "-" <+> variable y <+> P.text "|" <+> variable x <+> P.text "=" <+> pretty v) Insert e x v ->- P.braces (pretty e <+> P.text "|" <+> P.text x <+> P.text "=" <+> pretty v)+ P.braces (pretty e <+> P.text "|" <+> variable x <+> P.text "=" <+> pretty v) Modify e fs -> P.braces $ P.hang (pretty e <+> P.text "|") 4 (commaSep $ map field fs) where- field (x,e) = P.text x <+> P.text "<-" <+> pretty e+ field (x,e) = variable x <+> P.text "<-" <+> pretty e Record fs -> P.braces $ P.nest 2 (commaSep $ map field fs) where- field (x,e) = P.text x <+> P.text "=" <+> pretty e+ field (x,e) = variable x <+> P.text "=" <+> pretty e - Markdown _ -> P.text "[markdown| ... |]"+ Markdown _ _ -> P.text "[markdown| ... |]" instance Pretty (Def t v) where pretty def =
compiler/SourceSyntax/Literal.hs view
@@ -6,7 +6,7 @@ import qualified Text.PrettyPrint as PP data Literal = IntNum Int- | FloatNum Float+ | FloatNum Double | Chr Char | Str String | Boolean Bool@@ -16,7 +16,7 @@ pretty literal = case literal of IntNum n -> PP.int n- FloatNum n -> PP.float n+ FloatNum n -> PP.double n Chr c -> PP.quotes (PP.char c) Str s -> PP.text (show s) Boolean bool -> PP.text (show bool)
compiler/SourceSyntax/Module.hs view
@@ -12,7 +12,6 @@ import SourceSyntax.Declaration import SourceSyntax.Type import System.FilePath (joinPath)-import qualified Type.Type as Type data Module tipe var = Module [String] Exports Imports [Declaration tipe var]@@ -30,7 +29,7 @@ exports :: [String], imports :: [(String, ImportMethod)], program :: LExpr t v,- types :: Map.Map String Type.Variable,+ types :: Map.Map String Type, fixities :: [(Assoc, Int, String)], aliases :: [(String, [String], Type)], datatypes :: [ (String, [String], [(String,[Type])]) ],@@ -42,11 +41,23 @@ type ADT = (String, [String], [(String,[Type])]) data ModuleInterface = ModuleInterface {- iTypes :: Map.Map String Type,- iAdts :: [ADT],- iAliases :: [(String, [String], Type)]+ iTypes :: Map.Map String Type,+ iAdts :: [ADT],+ iAliases :: [(String, [String], Type)],+ iFixities :: [(Assoc, Int, String)] } deriving Show instance Binary ModuleInterface where- put modul = put (iTypes modul) >> put (iAdts modul) >> put (iAliases modul)- get = ModuleInterface <$> get <*> get <*> get+ get = ModuleInterface <$> get <*> get <*> get <*> get+ put modul = do+ put (iTypes modul)+ put (iAdts modul)+ put (iAliases modul)+ put (iFixities modul)+++instance Binary Assoc where+ get = do n <- getWord8+ return $ case n of { 0 -> L ; 1 -> N ; 2 -> R }++ put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }
compiler/SourceSyntax/Pattern.hs view
@@ -27,8 +27,8 @@ case pattern of PVar x -> variable x PLiteral lit -> pretty lit- PRecord fs -> PP.braces (commaCat $ map PP.text fs)- PAlias x p -> prettyParens p <+> PP.text "as" <+> PP.text x+ PRecord fs -> PP.braces (commaCat $ map variable fs)+ PAlias x p -> prettyParens p <+> PP.text "as" <+> variable x PAnything -> PP.text "_" PData "::" [hd,tl] -> parensIf isCons (pretty hd) <+> PP.text "::" <+> pretty tl where isCons = case hd of
compiler/SourceSyntax/PrettyPrint.hs view
@@ -15,4 +15,9 @@ parensIf bool doc = if bool then parens doc else doc -variable x = parensIf (Help.isOp x) (text x)+variable x =+ if Help.isOp x then parens (text x)+ else text (reprime x)++reprime :: String -> String+reprime = map (\c -> if c == '$' then '\'' else c)
compiler/SourceSyntax/Type.hs view
@@ -41,8 +41,11 @@ | Help.isTuple name -> P.parens . P.sep . P.punctuate P.comma $ map pretty tipes | otherwise -> P.hang (P.text name) 2 (P.sep $ map prettyParens tipes) EmptyRecord -> P.braces P.empty- Record fields ext -> P.braces $ P.hang (pretty ext <+> P.text "|") 4 prettyFields+ Record _ _ -> P.braces $ case ext of+ EmptyRecord -> prettyFields+ _ -> P.hang (pretty ext <+> P.text "|") 4 prettyFields where+ (fields, ext) = collectRecords tipe prettyField (f,t) = P.text f <+> P.text ":" <+> pretty t prettyFields = commaSep . map prettyField $ fields @@ -52,11 +55,19 @@ Lambda arg body -> pretty arg : collectLambdas body _ -> [pretty tipe] +collectRecords = go []+ where+ go fields tipe =+ case tipe of+ Record fs ext -> go (fs ++ fields) ext+ _ -> (fields, tipe)+ prettyParens tipe = parensIf needed (pretty tipe) where needed = case tipe of Lambda _ _ -> True+ Data "_List" [_] -> False Data _ [] -> False Data _ _ -> True _ -> False
compiler/Transform/Canonicalize.hs view
@@ -18,10 +18,11 @@ interface :: String -> ModuleInterface -> ModuleInterface interface moduleName iface =- ModuleInterface {- iTypes = Map.mapKeys prefix (Map.map renameType' (iTypes iface)),- iAdts = map (both prefix renameCtors) (iAdts iface),- iAliases = map (both prefix renameType') (iAliases iface)+ ModuleInterface+ { iTypes = Map.mapKeys prefix (Map.map renameType' (iTypes iface))+ , iAdts = map (both prefix renameCtors) (iAdts iface)+ , iAliases = map (both prefix renameType') (iAliases iface)+ , iFixities = iFixities iface -- cannot have canonicalized operators while parsing } where both f g (a,b,c) = (f a, b, g c)@@ -56,10 +57,19 @@ program' <- rename initialEnv (program modul) aliases' <- mapM (third renameType') (aliases modul) datatypes' <- mapM (third (mapM (second (mapM renameType')))) (datatypes modul)- return $ modul { program = program', aliases = aliases', datatypes = datatypes' }+ exports' <- mapM (third renameType') (foreignExports modul)+ imports' <- mapM (twoAndFour (rename initialEnv) renameType') (foreignImports modul)+ return $ modul { program = program'+ , aliases = aliases'+ , datatypes = datatypes'+ , foreignExports = exports'+ , foreignImports = imports' } where second f (a,b) = (,) a `fmap` f b third f (a,b,c) = (,,) a b `fmap` f c+ twoAndFour f g (a,b,c,d) = do b' <- f b+ d' <- g d+ return (a,b',c,d') renameType' = Either.either (\err -> Left [P.text err]) return . renameType (replace "type" initialEnv) @@ -79,7 +89,7 @@ pair n = (n,n) localEnv = map pair (map get1 (aliases modul) ++ map get1 (datatypes modul))- globalEnv = map pair $ ["_List",saveEnvName,"::","[]","Int","Float","Char","Bool"] +++ globalEnv = map pair $ ["_List",saveEnvName,"::","[]","Int","Float","Char","Bool","String"] ++ map (\n -> "_Tuple" ++ show n) [0..9] realImports = filter (not . List.isPrefixOf "Native." . fst) (imports modul) initialEnv = Map.fromList (concatMap canon realImports ++ localEnv ++ globalEnv)@@ -163,7 +173,7 @@ branch (pattern,e) = (,) `liftM` format (renamePattern env pattern) `ap` rename (extend env pattern) e - Markdown _ -> return expr+ Markdown md es -> Markdown md `liftM` mapM rnm es renamePattern :: Env -> Pattern -> Either String Pattern
compiler/Transform/Check.hs view
@@ -2,9 +2,11 @@ import Transform.SortDefinitions (boundVars) import SourceSyntax.Everything+import SourceSyntax.PrettyPrint import qualified SourceSyntax.Type as T import Data.List as List import qualified Data.Map as Map+import qualified Data.Maybe as Maybe import qualified Data.Set as Set import Data.Data import Data.Generics.Uniplate.Data@@ -13,7 +15,7 @@ mistakes :: (Data t, Data v) => [Declaration t v] -> [Doc] mistakes decls =- map P.text $ concatMap findErrors (getLets decls)+ illFormedTypes decls ++ map P.text (concatMap findErrors (getLets decls)) where findErrors defs = duplicates defs ++ badOrder defs @@ -60,4 +62,46 @@ _ -> [] +illFormedTypes :: [Declaration t v] -> [Doc]+illFormedTypes decls = map report (Maybe.mapMaybe isIllFormed (aliases ++ adts))+ where+ aliases = [ (decl, tvars, [tipe]) | decl@(TypeAlias _ tvars tipe) <- decls ]+ adts = [ (decl, tvars, concatMap snd ctors) | decl@(Datatype _ tvars ctors) <- decls ] + freeVars tipe =+ case tipe of+ T.Lambda t1 t2 -> Set.union (freeVars t1) (freeVars t2)+ T.Var x -> Set.singleton x+ T.Data _ ts -> Set.unions (map freeVars ts)+ T.EmptyRecord -> Set.empty+ T.Record fields ext -> Set.unions (freeVars ext : map (freeVars . snd) fields)++ undeclared tvars tipes = Set.difference used declared+ where+ used = Set.unions (map freeVars tipes)+ declared = Set.fromList tvars++ isIllFormed (decl, tvars, tipes) =+ let unbound = undeclared tvars tipes in + if Set.null unbound then Nothing+ else Just (decl, Set.toList unbound)++ report (decl, tvars) =+ P.vcat [ P.text $ "Error: type variable" ++ listing ++ " unbound in:"+ , P.text "\n"+ , nest 4 (pretty decl) ]+ where+ listing =+ case tvars of+ [tvar] -> " " ++ quote tvar ++ " is"+ _ -> "s" ++ addCommas (map ((++) " ") (addAnd (map quote tvars))) ++ " are"++ addCommas xs+ | length xs < 3 = concat xs+ | otherwise = intercalate "," xs++ addAnd xs+ | length xs < 2 = xs+ | otherwise = zipWith (++) (replicate (length xs - 1) "" ++ ["and "]) xs++ quote tvar = "'" ++ tvar ++ "'"
compiler/Transform/SortDefinitions.hs view
@@ -97,7 +97,7 @@ Record fields -> Record `liftM` mapM reorderField fields - Markdown _ -> return expr+ Markdown md es -> Markdown md <$> mapM reorder es -- Actually do some reordering Let defs body ->
compiler/Transform/Substitute.hs view
@@ -1,9 +1,11 @@ {-# OPTIONS_GHC -Wall #-} module Transform.Substitute (subst) where +import Control.Arrow (second, (***)) import SourceSyntax.Expression import SourceSyntax.Location-import Control.Arrow (second, (***))+import qualified Data.Set as Set+import qualified Transform.SortDefinitions as SD subst :: String -> Expr t v -> Expr t v -> Expr t v subst old new expr =@@ -12,12 +14,23 @@ Range e1 e2 -> Range (f e1) (f e2) ExplicitList es -> ExplicitList (map f es) Binop op e1 e2 -> Binop op (f e1) (f e2)- Lambda p e -> Lambda p (f e)+ Lambda p e+ | Set.member old (SD.boundVars p) -> expr+ | otherwise -> Lambda p (f e) App e1 e2 -> App (f e1) (f e2) MultiIf ps -> MultiIf (map (f *** f) ps)- Let defs body -> Let (map substDef defs) (f body)- where substDef (Def name e) = Def name (f e)- substDef anno@(TypeAnnotation _ _) = anno++ Let defs body+ | anyShadow -> expr+ | otherwise -> Let (map substDef defs) (f body)+ where+ anyShadow =+ any (Set.member old . SD.boundVars) [ p | Def p _ <- defs ]+ substDef def =+ case def of+ TypeAnnotation _ _ -> def+ Def p e -> Def p (f e)+ Var x -> if x == old then new else expr Case e cases -> Case (f e) $ map (second f) cases Data name es -> Data name (map f es)@@ -27,4 +40,4 @@ Modify r fs -> Modify (f r) (map (second f) fs) Record fs -> Record (map (second f) fs) Literal _ -> expr- Markdown _ -> expr+ Markdown md es -> Markdown md (map f es)
+ compiler/Type/Alias.hs view
@@ -0,0 +1,135 @@+module Type.Alias (realias, rules, canonicalRealias, Rules) where++import Control.Applicative ((<$>),(<*>))+import Control.Monad+import Control.Arrow (second)+import Data.Map ((!))+import qualified Data.Map as Map+import qualified Data.List as List+import SourceSyntax.Type+import SourceSyntax.Module++type Rules = ([(String,[String],Type)], Type -> Type)++rules interfaces metaModule = (collect interfaces metaModule, localizer metaModule)++collect interfaces metaModule = filter (not . isPrimitive) rawAliases+ where+ rawAliases = aliases metaModule ++ concatMap iAliases (Map.elems interfaces)++ isPrimitive (_,_,tipe) =+ case tipe of+ Data _ [] -> True+ _ -> False++localizer metaModule = go+ where+ go tipe = + case tipe of+ Var _ -> tipe+ EmptyRecord -> tipe+ Lambda t1 t2 -> Lambda (go t1) (go t2)+ Data name ts -> Data (localize name) (map go ts)+ Record fs ext -> Record (map (second go) fs) (go ext)++ byMethod = foldr (\(n,m) d -> Map.insertWith (++) n [m] d) Map.empty (imports metaModule)++ separate name =+ case List.elemIndices '.' name of+ [] -> ("",name)+ is -> let i = last is in+ (take i name, drop (i+1) name)++ shortest = List.minimumBy (\a b -> compare (length a) (length b))++ localize name = shortest (name : concatMap (localize' value) methods)+ where (modul, value) = separate name+ methods = Map.findWithDefault [] modul byMethod++ localize' name method =+ case method of+ As modul -> [modul ++ "." ++ name]+ Hiding xs | name `notElem` xs -> [name]+ Importing xs | name `elem` xs -> [name]+ _ -> []++realias :: Rules -> Type -> Type+realias (aliases,localize) tipe = localize (canonicalRealias aliases tipe)++-- Realias using canonical aliases, so results will have aliases+-- that are fully qualified and possible to compare.+canonicalRealias :: [(String,[String],Type)] -> Type -> Type+canonicalRealias aliases tipe =+ case concatMap tryRealias aliases of+ [] -> if tipe == tipe' then tipe else f tipe'+ tipes -> f (bestType tipes)+ where+ tryRealias (name, args, aliasTipe) =+ case diff aliasTipe tipe of+ Nothing -> []+ Just kvs ->+ let holes = collectFields kvs+ hasArgs = List.sort args == Map.keys holes+ isConsistent = all allEqual (Map.elems holes)+ in case hasArgs && isConsistent of+ False -> []+ True -> [Data name $ map (\arg -> head (holes ! arg)) args]++ f = canonicalRealias aliases+ tipe' =+ case tipe of+ Var _ -> tipe+ EmptyRecord -> tipe+ Lambda t1 t2 -> Lambda (f t1) (f t2)+ Data name ts -> Data name (map f ts)+ Record fs ext -> Record (map (second f) fs) (f ext)++allEqual [] = True+allEqual (x:xs) = all (==x) xs++bestType tipes = fst $ List.minimumBy (\a b -> compare (snd a) (snd b)) pairs+ where+ pairs :: [(Type,Int)]+ pairs = zip tipes (map numFields tipes)++ numFields :: Type -> Int+ numFields tipe =+ case tipe of+ Lambda t1 t2 -> numFields t1 + numFields t2+ Var _ -> 0+ Data _ ts -> sum (map numFields ts)+ EmptyRecord -> 0+ Record fields ext -> length fields + sum (map (numFields . snd) fields) + numFields ext++diff :: Type -> Type -> Maybe [(String,Type)]+diff general specific =+ case (general, specific) of+ (Lambda g1 g2, Lambda s1 s2) -> (++) <$> diff g1 s1 <*> diff g2 s2+ (Var x, t) -> Just [(x,t)]+ (Data gname gts, Data sname sts)+ | gname == sname && length gts == length sts ->+ concat <$> zipWithM diff gts sts+ (EmptyRecord, EmptyRecord) -> Just []+ (Record _ _, Record _ _) ->+ let (gfs,gext) = collectRecords general+ (sfs,sext) = collectRecords specific+ gfields = collectFields gfs+ sfields = collectFields sfs++ overlap = Map.intersectionWith (\gs ss -> length gs == length ss) sfields gfields+ isAligned = Map.size gfields == Map.size overlap && and (Map.elems overlap)+ in+ case isAligned of+ False -> Nothing+ True -> let remaining = Map.difference sfields gfields+ sext' = if Map.null remaining then sext else+ Record (flattenFields remaining) sext+ matchMap = Map.intersectionWith (zipWith diff) gfields sfields+ in concat <$> sequence (diff gext sext' : concat (Map.elems matchMap))+ (_,_) -> Nothing++collectFields fields =+ foldr (\(f,t) fs -> Map.insertWith (++) f [t] fs) Map.empty fields++flattenFields fields =+ concatMap (\(f,ts) -> map ((,) f) ts) (Map.toList fields)
compiler/Type/Constrain/Expression.hs view
@@ -6,9 +6,10 @@ import Control.Arrow (second) import Control.Applicative ((<$>),(<*>)) import qualified Control.Monad as Monad-import Control.Monad.Error (ErrorT, runErrorT)+import Control.Monad.Error import Control.Monad.State import Data.Traversable (traverse)+import qualified Text.PrettyPrint as PP import SourceSyntax.Location as Loc import SourceSyntax.Pattern (Pattern(PVar))@@ -22,7 +23,7 @@ import qualified Transform.SortDefinitions as SD -constrain :: Env.Environment -> LExpr a b -> Type -> IO TypeConstraint+constrain :: Env.Environment -> LExpr a b -> Type -> ErrorT [PP.Doc] IO TypeConstraint constrain env (L span expr) tipe = let list t = Env.get env Env.types "_List" <| t and = L span . CAnd@@ -32,9 +33,10 @@ clet schemes c = L span (CLet schemes c) in case expr of- Literal lit -> Literal.constrain env span lit tipe+ Literal lit -> liftIO $ Literal.constrain env span lit tipe - Var name -> return (name <? tipe)+ Var name | name == saveEnvName -> return (L span CSaveEnv)+ | otherwise -> return (name <? tipe) Range lo hi -> exists $ \x -> do@@ -86,7 +88,7 @@ and . (:) ce <$> mapM branch branches Data name exprs ->- do vars <- forM exprs $ \_ -> var Flexible+ do vars <- forM exprs $ \_ -> liftIO (var Flexible) let pairs = zip exprs (map VarN vars) (ctipe, cs) <- Monad.foldM step (tipe,true) (reverse pairs) return $ ex vars (cs /\ name <? ctipe)@@ -113,11 +115,11 @@ Modify e fields -> exists $ \t -> do- oldVars <- forM fields $ \_ -> var Flexible+ oldVars <- forM fields $ \_ -> liftIO (var Flexible) let oldFields = SrcT.fieldMap (zip (map fst fields) (map VarN oldVars)) cOld <- ex oldVars <$> constrain env e (record oldFields t) - newVars <- forM fields $ \_ -> var Flexible+ newVars <- forM fields $ \_ -> liftIO (var Flexible) let newFields = SrcT.fieldMap (zip (map fst fields) (map VarN newVars)) let cNew = tipe === record newFields t @@ -126,19 +128,20 @@ return $ cOld /\ ex newVars (and (cNew : cs)) Record fields ->- do vars <- forM fields $ \_ -> var Flexible+ do vars <- forM fields $ \_ -> liftIO (var Flexible) cs <- zipWithM (constrain env) (map snd fields) (map VarN vars) let fields' = SrcT.fieldMap (zip (map fst fields) (map VarN vars)) recordType = record fields' (TermN EmptyRecord1) return . ex vars . and $ tipe === recordType : cs - Markdown _ ->- return ("Graphics.Element.markdown" <? tipe)+ Markdown _ es ->+ do vars <- forM es $ \_ -> liftIO (var Flexible)+ let tvars = map VarN vars+ cs <- zipWithM (constrain env) es tvars+ return . ex vars $ and ("Text.markdown" <? tipe : cs) Let defs body ->- do c <- case body of- L _ (Var name) | name == saveEnvName -> return (L span CSaveEnv)- _ -> constrain env body tipe+ do c <- constrain env body tipe (schemes, rqs, fqs, header, c2, c1) <- Monad.foldM (constrainDef env) ([], [], [], Map.empty, true, true)@@ -147,15 +150,16 @@ (clet [Scheme rqs fqs (clet [monoscheme header] c2) header ] (c1 /\ c)) + constrainDef env info (pattern, expr, maybeTipe) = let qs = [] -- should come from the def, but I'm not sure what would live there... (schemes, rigidQuantifiers, flexibleQuantifiers, headers, c2, c1) = info in- do rigidVars <- mapM (\_ -> var Rigid) qs -- Some mistake may be happening here.- -- Currently, qs is always the empty list.+ do rigidVars <- forM qs (\_ -> liftIO $ var Rigid) -- Some mistake may be happening here.+ -- Currently, qs is always []. case (pattern, maybeTipe) of (PVar name, Just tipe) -> do- flexiVars <- mapM (\_ -> var Flexible) qs+ flexiVars <- forM qs (\_ -> liftIO $ var Flexible) let inserts = zipWith (\arg typ -> Map.insert arg (VarN typ)) qs flexiVars env' = env { Env.value = List.foldl' (\x f -> f x) (Env.value env) inserts } (vars, typ) <- Env.instantiateType env tipe Map.empty@@ -172,7 +176,7 @@ , fl rigidVars c /\ c1 ) (PVar name, Nothing) -> do- v <- var Flexible+ v <- liftIO $ var Flexible let tipe = VarN v inserts = zipWith (\arg typ -> Map.insert arg (VarN typ)) qs rigidVars env' = env { Env.value = List.foldl' (\x f -> f x) (Env.value env) inserts }@@ -184,7 +188,6 @@ , c /\ c2 , c1 ) - expandPattern :: (Pattern, LExpr t v, Maybe SrcT.Type) -> [(Pattern, LExpr t v, Maybe SrcT.Type)] expandPattern triple@(pattern, lexpr@(L s _), maybeType) =@@ -213,9 +216,9 @@ TypeAnnotation name typ -> go output defs (Map.insert name typ typs) ds -try :: SrcSpan -> ErrorT String IO a -> IO a+try :: SrcSpan -> ErrorT (SrcSpan -> PP.Doc) IO a -> ErrorT [PP.Doc] IO a try span computation = do- result <- runErrorT computation+ result <- liftIO $ runErrorT computation case result of- Left msg -> error $ "\nType error " ++ show span ++ "\n" ++ msg+ Left err -> throwError [err span] Right value -> return value
compiler/Type/Constrain/Literal.hs view
@@ -10,12 +10,12 @@ do tipe' <- litType return . L span $ CEqual tipe tipe' where- prim name = Env.get env Env.types name+ prim name = return (Env.get env Env.types name) litType = case literal of IntNum _ -> VarN `fmap` var (Is Number)- FloatNum _ -> return (prim "Float")- Chr _ -> return (prim "Char")- Str _ -> return (TermN (App1 (prim "_List") (prim "Char")))- Boolean _ -> return (prim "Bool")+ FloatNum _ -> prim "Float"+ Chr _ -> prim "Char"+ Str _ -> prim "String"+ Boolean _ -> prim "Bool"
compiler/Type/Constrain/Pattern.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleInstances #-} module Type.Constrain.Pattern where import Control.Arrow (second)@@ -7,8 +8,10 @@ import qualified Data.List as List import qualified Data.Maybe as Maybe import qualified Data.Map as Map+import qualified Text.PrettyPrint as PP import SourceSyntax.Pattern+import SourceSyntax.Location import SourceSyntax.PrettyPrint import Text.PrettyPrint (render) import qualified SourceSyntax.Location as Loc@@ -18,7 +21,7 @@ import qualified Type.Constrain.Literal as Literal -constrain :: Environment -> Pattern -> Type -> ErrorT String IO Fragment+constrain :: Environment -> Pattern -> Type -> ErrorT (SrcSpan -> PP.Doc) IO Fragment constrain env pattern tipe = let span = Loc.NoSpan (render $ pretty pattern) t1 === t2 = Loc.L span (CEqual t1 t2)@@ -51,7 +54,11 @@ let msg = concat [ "Constructor '", name, "' expects ", show kind , " argument", if kind == 1 then "" else "s" , " but was given ", show (length patterns), "." ]- if length patterns /= kind then throwError msg else do+ err span = PP.vcat [ PP.text $ "Type error " ++ show span+ , PP.text msg ]+ case length patterns == kind of+ False -> throwError err+ True -> do fragment <- Monad.liftM joinFragments (Monad.zipWithM (constrain env) patterns args) return $ fragment { typeConstraint = typeConstraint fragment /\ tipe === result,@@ -61,9 +68,15 @@ PRecord fields -> do pairs <- liftIO $ mapM (\name -> (,) name <$> var Flexible) fields let tenv = Map.fromList (map (second VarN) pairs)- c <- liftIO . exists $ \t -> return (tipe === record (Map.map (:[]) tenv) t)+ c <- exists $ \t -> return (tipe === record (Map.map (:[]) tenv) t) return $ Fragment { typeEnv = tenv, vars = map snd pairs, typeConstraint = c }++instance Error (SrcSpan -> PP.Doc) where+ noMsg _ = PP.empty+ strMsg str span =+ PP.vcat [ PP.text $ "Type error " ++ show span+ , PP.text str ]
compiler/Type/Environment.hs view
@@ -1,12 +1,16 @@ module Type.Environment where import Control.Applicative ((<$>), (<*>))+import Control.Exception (try, SomeException) import Control.Monad+import Control.Monad.Trans.Error (ErrorList(..))+import Control.Monad.Error (ErrorT, throwError, liftIO) import qualified Control.Monad.State as State import qualified Data.Traversable as Traverse import qualified Data.Map as Map import Data.List (isPrefixOf) import qualified Data.UnionFind.IO as UF+import qualified Text.PrettyPrint as PP import qualified SourceSyntax.Type as Src import SourceSyntax.Module (ADT)@@ -51,7 +55,7 @@ builtins :: [(String,Int)] builtins = concat [ map tuple [0..9] , kind 1 ["_List"]- , kind 0 ["Int","Float","Char","Bool"]+ , kind 0 ["Int","Float","Char","String","Bool"] ] @@ -105,11 +109,15 @@ freshDataScheme :: Environment -> String -> IO (Int, [Variable], [Type], Type) freshDataScheme env name = get env constructor name -instantiateType ::- Environment -> Src.Type -> VarDict -> IO ([Variable], Type)+instance ErrorList PP.Doc where+ listMsg str = [PP.text str]++instantiateType :: Environment -> Src.Type -> VarDict -> ErrorT [PP.Doc] IO ([Variable], Type) instantiateType env sourceType dict =- do (tipe, (dict',_)) <- State.runStateT (instantiator env sourceType) (dict, Map.empty)- return (Map.elems dict', tipe)+ do result <- liftIO $ try (State.runStateT (instantiator env sourceType) (dict, Map.empty))+ case result :: Either SomeException (Type, (VarDict, TypeDict)) of+ Left someError -> throwError [ PP.text $ show someError ]+ Right (tipe, (dict',_)) -> return (Map.elems dict', tipe) instantiator :: Environment -> Src.Type -> State.StateT (VarDict, TypeDict) IO Type@@ -134,9 +142,6 @@ | "comparable" `isPrefixOf` x = Is Comparable | "appendable" `isPrefixOf` x = Is Appendable | otherwise = Flexible-- Src.Data "String" [] ->- return (get env types "_List" <| get env types "Char") Src.Data name ts -> do ts' <- mapM go ts
+ compiler/Type/ExtraChecks.hs view
@@ -0,0 +1,73 @@+-- This module contains checks to be run *after* type inference has+-- completed successfully. At that point we still need to do occurs+-- checks and ensure that `main` has an acceptable type.+module Type.ExtraChecks (extraChecks) where++import Control.Applicative ((<$>),(<*>))+import qualified Data.Map as Map+import qualified Data.UnionFind.IO as UF+import Type.Type ( Variable, structure, Term1(..), toSrcType )+import Type.State (Env)+import qualified Type.Alias as Alias+import Text.PrettyPrint as P+import SourceSyntax.PrettyPrint (pretty)+import SourceSyntax.Type (Type)+import qualified Data.Traversable as Traverse++extraChecks :: Alias.Rules -> Env -> IO (Either [P.Doc] (Map.Map String Type))+extraChecks rules env = do+ eitherEnv <- occursCheck env+ case eitherEnv of+ Left errs -> return $ Left errs+ Right env' ->+ mainCheck rules <$> Traverse.traverse toSrcType env'+ ++mainCheck :: Alias.Rules -> (Map.Map String Type) -> Either [P.Doc] (Map.Map String Type)+mainCheck rules env =+ let acceptable = ["Graphics.Element.Element","Signal.Signal Graphics.Element.Element"] in+ case Map.lookup "main" env of+ Nothing -> Right env+ Just tipe+ | P.render (pretty (Alias.canonicalRealias (fst rules) tipe)) `elem` acceptable ->+ Right env+ | otherwise ->+ Left [ P.vcat [ P.text "Type Error:"+ , P.text "Bad type for 'main'. It must have type Element or a (Signal Element)"+ , P.text "Instead 'main' has type:\n"+ , P.nest 4 . pretty $ Alias.realias rules tipe+ , P.text " " ]+ ]++occursCheck :: Env -> IO (Either [P.Doc] Env)+occursCheck env = do+ errors <- concat <$> mapM isFinite (Map.toList env)+ return $ if null errors then Right env else Left errors++isFinite :: (String, Variable) -> IO [P.Doc]+isFinite (name, var) =+ do varIsFinite <- go [] var+ return $+ case varIsFinite of+ True -> []+ False -> [ P.vcat [ P.text "Type Error:"+ , P.text $ "Cannot construct infinite type for '" ++ name ++ "'\n"+ ]+ ]+ where+ go :: [Variable] -> Variable -> IO Bool+ go seen var =+ let check = go (var:seen) in+ case var `elem` seen of+ True -> return False+ False -> do+ desc <- UF.descriptor var+ case structure desc of+ Nothing -> return True+ Just struct ->+ case struct of+ App1 a b -> (&&) <$> check a <*> check b+ Fun1 a b -> (&&) <$> check a <*> check b+ Var1 a -> check a+ EmptyRecord1 -> return True+ Record1 fields ext -> and <$> mapM check (ext : concat (Map.elems fields))
compiler/Type/Inference.hs view
@@ -12,17 +12,20 @@ import qualified SourceSyntax.Expression as Expr import SourceSyntax.Location (Located, noneNoDocs) import SourceSyntax.PrettyPrint+import SourceSyntax.Type (Type) import Text.PrettyPrint import qualified Type.State as TS-import Control.Monad.State+import Type.ExtraChecks (extraChecks)+import Control.Monad.State (execStateT, forM)+import Control.Monad.Error (runErrorT, liftIO) import Control.Arrow (second)-import Transform.SortDefinitions as Sort+import qualified Type.Alias as Alias import System.IO.Unsafe -- Possible to switch over to the ST monad instead of -- the IO monad. I don't think that'd be worthwhile. -infer :: Interfaces -> MetadataModule t v -> Either [Doc] (Map.Map String T.Variable)+infer :: Interfaces -> MetadataModule t v -> Either [Doc] (Map.Map String Type) infer interfaces modul = unsafePerformIO $ do env <- Env.initialEnvironment (datatypes modul ++ concatMap iAdts (Map.elems interfaces))@@ -31,21 +34,25 @@ do (_, vars, args, result) <- Env.freshDataScheme env name return (name, (vars, foldr (T.==>) result args)) - importedVars <-- forM (concatMap (Map.toList . iTypes) $ Map.elems interfaces) $ \(name,tipe) ->- (,) name `fmap` Env.instantiateType env tipe Map.empty-- let allTypes = ctors ++ importedVars- vars = concatMap (fst . snd) allTypes- header = Map.map snd (Map.fromList allTypes)- environ = noneNoDocs . T.CLet [ T.Scheme vars [] (noneNoDocs T.CTrue) header ]+ attemptConstraint <- runErrorT $ do+ importedVars <-+ forM (concatMap (Map.toList . iTypes) $ Map.elems interfaces) $ \(name,tipe) ->+ (,) name `fmap` Env.instantiateType env tipe Map.empty - fvar <- T.var T.Flexible- constraint <- environ `fmap` TcExpr.constrain env (program modul) (T.VarN fvar)+ let allTypes = ctors ++ importedVars+ vars = concatMap (fst . snd) allTypes+ header = Map.map snd (Map.fromList allTypes)+ environ = noneNoDocs . T.CLet [ T.Scheme vars [] (noneNoDocs T.CTrue) header ] - state <- execStateT (Solve.solve constraint) TS.initialState- let errors = TS.sErrors state- if null errors- then return $ Right (Map.difference (TS.sSavedEnv state) header)- else Left `fmap` sequence (reverse errors)+ fvar <- liftIO $ T.var T.Flexible+ c <- TcExpr.constrain env (program modul) (T.VarN fvar)+ return (header, environ c) + case attemptConstraint of+ Left err -> return $ Left err+ Right (header, constraint) -> do+ state <- execStateT (Solve.solve constraint) TS.initialState+ let rules = Alias.rules interfaces modul+ case TS.sErrors state of+ errors@(_:_) -> Left `fmap` sequence (map ($ rules) (reverse errors))+ [] -> extraChecks rules (Map.difference (TS.sSavedEnv state) header)
compiler/Type/PrettyPrint.hs view
@@ -2,6 +2,7 @@ module Type.PrettyPrint where import Text.PrettyPrint+import qualified SourceSyntax.PrettyPrint as Src data ParensWhen = Fn | App | Never @@ -11,3 +12,5 @@ commaSep docs = sep (punctuate comma docs) parensIf bool doc = if bool then parens doc else doc++reprime = Src.reprime
compiler/Type/Solve.hs view
@@ -70,7 +70,9 @@ do desc <- liftIO $ UF.descriptor variable case () of () | mark desc == youngMark ->- do rank' <- case structure desc of+ do -- Set the variable as marked first because it may be cyclic.+ liftIO $ UF.modifyDescriptor variable $ \desc -> desc { mark = visitedMark }+ rank' <- case structure desc of Nothing -> return groupRank Just term -> case term of@@ -82,7 +84,7 @@ do ranks <- mapM adjust (concat (Map.elems fields)) rnk <- adjust extension return . maximum $ rnk : ranks- liftIO $ UF.setDescriptor variable (desc { mark = visitedMark, rank = rank' })+ liftIO $ UF.modifyDescriptor variable $ \desc -> desc { rank = rank' } return rank' | mark desc /= visitedMark ->
compiler/Type/State.hs view
@@ -11,6 +11,8 @@ import Text.PrettyPrint as P import SourceSyntax.PrettyPrint import SourceSyntax.Location+import qualified SourceSyntax.Type as Src+import qualified Type.Alias as Alias -- Pool -- Holds a bunch of variables@@ -24,13 +26,15 @@ emptyPool = Pool { maxRank = outermostRank, inhabitants = [] } +type Env = Map.Map String Variable+ -- Keeps track of the environment, type variable pool, and a list of errors data SolverState = SS {- sEnv :: Map.Map String Variable,- sSavedEnv :: Map.Map String Variable,+ sEnv :: Env,+ sSavedEnv :: Env, sPool :: Pool, sMark :: Int,- sErrors :: [IO P.Doc]+ sErrors :: [Alias.Rules -> IO P.Doc] } initialState = SS {@@ -45,9 +49,19 @@ modifyPool f = modify $ \state -> state { sPool = f (sPool state) } addError span message t1 t2 =- modify $ \state -> state { sErrors = err : sErrors state }+ modify $ \state -> state { sErrors = makeError : sErrors state } where- err = makeError <$> extraPretty t1 <*> extraPretty t2+ makeError rules = do+ let prettiest = pretty . Alias.realias rules+ t1' <- prettiest <$> toSrcType t1+ t2' <- prettiest <$> toSrcType t2+ return . P.vcat $+ [ P.text $ "Type error" ++ location ++ ":"+ , P.vcat . map P.text . lines $ if null message then defaultMessage else message+ , P.text src+ , P.text " Expected Type:" <+> t1'+ , P.text " Actual Type:" <+> t2' <> P.text "\n"+ ] location = case span of NoSpan msg -> ""@@ -64,20 +78,13 @@ defaultMessage = "Something weird is happening with this value:" - makeError pt1 pt2 =- P.vcat [ P.text $ "Type error" ++ location ++ ":"- , P.vcat . map P.text . lines $ if null message then defaultMessage else message- , P.text src- , P.text " Expected Type:" <+> pt1- , P.text " Actual Type:" <+> pt2 <> P.text "\n"- ] switchToPool pool = modifyPool (\_ -> pool) getPool :: StateT SolverState IO Pool getPool = sPool <$> get -getEnv :: StateT SolverState IO (Map.Map String Variable)+getEnv :: StateT SolverState IO Env getEnv = sEnv <$> get saveLocalEnv :: StateT SolverState IO ()
compiler/Type/Type.hs view
@@ -9,6 +9,7 @@ import System.IO.Unsafe import Control.Applicative ((<$>),(<*>)) import Control.Monad.State+import Control.Monad.Error import Data.Traversable (traverse) import SourceSyntax.Location import SourceSyntax.Helpers (isTuple)@@ -130,9 +131,9 @@ fl :: [Variable] -> TypeConstraint -> TypeConstraint fl rqs constraint@(L s _) = L s $ CLet [Scheme rqs [] constraint Map.empty] (L s CTrue) -exists :: (Type -> IO TypeConstraint) -> IO TypeConstraint+exists :: Error e => (Type -> ErrorT e IO TypeConstraint) -> ErrorT e IO TypeConstraint exists f = do- v <- var Flexible+ v <- liftIO $ var Flexible ex [v] <$> f (VarN v) @@ -176,7 +177,7 @@ prettyExt = prty ext extend | P.render prettyExt == "{}" = P.empty | otherwise = prettyExt <+> P.text "|"- mkPretty f t = P.text f <+> P.text ":" <+> prty t+ mkPretty f t = P.text (reprime f) <+> P.text ":" <+> prty t prettyFields = concatMap (\(f,ts) -> map (mkPretty f) ts) (Map.toList fields) @@ -191,7 +192,7 @@ pretty when desc = case (structure desc, name desc) of (Just term, _) -> pretty when term- (_, Just name) -> if not (isTuple name) then P.text name else+ (_, Just name) -> if not (isTuple name) then P.text (reprime name) else P.parens . P.text $ replicate (read (drop 6 name) - 1) ',' _ -> P.text "?"
compiler/Type/Unify.hs view
@@ -82,10 +82,10 @@ comparableError str = TS.addError span (str ++ msg) variable1 variable2 where msg = "Expecting something comparable such as an\n" ++- "Int, Float, Char, or a list or tuple of comparables."+ "Int, Float, Char, String, or a list or tuple of comparables." unifyComparable var name- | name `elem` ["Int","Float","Char","comparable"] = flexAndUnify var+ | name `elem` ["Int","Float","Char","String","comparable"] = flexAndUnify var | otherwise = comparableError "" unifyComparableStructure varSuper varFlex =@@ -129,8 +129,10 @@ (Is Comparable, _, _, _) -> unifyComparableStructure variable1 variable2 (_, Is Comparable, _, _) -> unifyComparableStructure variable2 variable1 - (Is Appendable, _, _, Just "Text.Text") -> flexAndUnify variable1- (_, Is Appendable, Just "Text.Text", _) -> flexAndUnify variable2+ (Is Appendable, _, _, Just ctor)+ | ctor `elem` ["Text.Text","String"] -> flexAndUnify variable1+ (_, Is Appendable, Just ctor, _)+ | ctor `elem` ["Text.Text","String"] -> flexAndUnify variable2 (Is Appendable, _, _, _) -> unifyAppendable variable1 variable2 (_, Is Appendable, _, _) -> unifyAppendable variable2 variable1
− compiler/Unique.hs
@@ -1,19 +0,0 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-module Unique (guid, set, run, runAt, Unique) where--import Control.Monad.State (evalState, State, get, put)---- Wrapper around State monad.-newtype Unique a = U { runU :: State Int a }- deriving (Monad)---- Get the next GUID, incrementing the counter.-guid :: Unique Int-guid = U $ do n <- get- put (n + 1)- return n--set n = U (put n)--run = runAt 0-runAt n x = evalState (runU x) n
+ data/docs.json view
@@ -0,0 +1,10034 @@+[+{+ "name": "Automaton",+ "document": "This library is a way to package up dynamic behavior. It makes it easier to\ndynamically create dynamic components. See the [original release\nnotes](/blog/announce/version-0.5.0.elm) on this library to get a feel for how\nit can be used.\n\n# Create\n@docs pure, state, hiddenState\n\n# Evaluate\n@docs run, step\n\n# Combine\n@docs (\u003e\u003e\u003e), (\u003c\u003c\u003c), combine\n\n# Common Automatons\n@docs count, average",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "\u003c\u003c\u003c",+ "comment": "Compose two automatons, chaining them together.",+ "raw": "(\u003c\u003c\u003c) : Automaton b c -\u003e Automaton a b -\u003e Automaton a c",+ "type": [+ "-\u003e",+ [+ "Automaton",+ "b",+ "c"+ ],+ [+ "-\u003e",+ [+ "Automaton",+ "a",+ "b"+ ],+ [+ "Automaton",+ "a",+ "c"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 9+ },+ {+ "name": "\u003e\u003e\u003e",+ "comment": "Compose two automatons, chaining them together.",+ "raw": "(\u003e\u003e\u003e) : Automaton a b -\u003e Automaton b c -\u003e Automaton a c",+ "type": [+ "-\u003e",+ [+ "Automaton",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "Automaton",+ "b",+ "c"+ ],+ [+ "Automaton",+ "a",+ "c"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 9+ },+ {+ "name": "average",+ "comment": "Computes the running average of the last `n` inputs.",+ "raw": "average : Int -\u003e Automaton Float Float",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Automaton",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "combine",+ "comment": "Combine a list of automatons into a single automaton that produces a\nlist.",+ "raw": "combine : [Automaton a b] -\u003e Automaton a [b]",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Automaton",+ "a",+ "b"+ ]+ ],+ [+ "Automaton",+ "a",+ [+ "_List",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "count",+ "comment": "Count the number of steps taken.",+ "raw": "count : Automaton a Int",+ "type": [+ "Automaton",+ "a",+ [+ "Int"+ ]+ ]+ },+ {+ "name": "hiddenState",+ "comment": "Create an automaton with hidden state. Requires an initial state and a\nstep function to step the state forward and produce an output.",+ "raw": "hiddenState : s -\u003e (a -\u003e s -\u003e (s,b)) -\u003e Automaton a b",+ "type": [+ "-\u003e",+ "s",+ [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "s",+ [+ "_Tuple2",+ "s",+ "b"+ ]+ ]+ ],+ [+ "Automaton",+ "a",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "pure",+ "comment": "Create an automaton with no memory. It just applies the given function to\nevery input.",+ "raw": "pure : (a -\u003e b) -\u003e Automaton a b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "Automaton",+ "a",+ "b"+ ]+ ]+ },+ {+ "name": "run",+ "comment": "Run an automaton on a given signal. The automaton steps forward whenever the\ninput signal updates.",+ "raw": "run : Automaton a b -\u003e b -\u003e Signal a -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "Automaton",+ "a",+ "b"+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ]+ ]+ },+ {+ "name": "state",+ "comment": "Create an automaton with state. Requires an initial state and a step\nfunction to step the state forward. For example, an automaton that counted\nhow many steps it has taken would look like this:\n\n count = Automaton a Int\n count = state 0 (\\\\_ c -\u003e c+1)\n\nIt is a stateful automaton. The initial state is zero, and the step function\nincrements the state on every step.",+ "raw": "state : b -\u003e (a -\u003e b -\u003e b) -\u003e Automaton a b",+ "type": [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "Automaton",+ "a",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "step",+ "comment": "Step an automaton forward once with a given input.",+ "raw": "step : a -\u003e Automaton a b -\u003e (Automaton a b, b)",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Automaton",+ "a",+ "b"+ ],+ [+ "_Tuple2",+ [+ "Automaton",+ "a",+ "b"+ ],+ "b"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Basics",+ "document": "Tons of useful functions that get imported by default.\n\nThe following libraries also get imported by default: List, Signal,\nText, Maybe, Time, Graphics.Element, Color, Graphics.Collage.\n\n# Equality\n@docs (==), (/=)\n\n# Comparison\n\nThese functions only work on `comparable` types. This includes numbers,\ncharacters, strings, lists of comparable things, and tuples of comparable\nthings. Note that tuples with 7 or more elements are not comparable; why\nare your tuples so big?\n\n@docs (\u003c), (\u003e), (\u003c=), (\u003e=), max, min, Order, compare\n\n# Booleans\n@docs not, (&&), (||), xor, otherwise\n\n# Mathematics\n@docs (+), (-), (*), (/), (^), div, rem, mod, abs, sqrt, clamp, logBase, e\n\n# Trigonometry\n@docs pi, cos, sin, tan, acos, asin, atan, atan2\n\n# Number Conversions\n@docs round, floor, ceiling, truncate, toFloat\n\n# Angle Conversions\nAll angle conversions result in “standard Elm angles”\nwhich happen to be radians.\n\n@docs degrees, radians, turns\n\n# Polar Coordinates\n@docs toPolar, fromPolar\n\n# Tuples\n@docs fst, snd\n\n# Higher-Order Helpers\n@docs id, (\u003c|), (|\u003e), (.), flip, curry, uncurry",+ "aliases": [],+ "datatypes": [+ {+ "name": "Order",+ "comment": "Represents the relative ordering of two things.\nThe relations are less than, equal to, and greater than.",+ "raw": "data Order = LT | EQ | GT",+ "typeVariables": [],+ "constructors": [+ {+ "name": "LT",+ "type": [+ "Order"+ ]+ },+ {+ "name": "EQ",+ "type": [+ "Order"+ ]+ },+ {+ "name": "GT",+ "type": [+ "Order"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "&&",+ "comment": "The and operator. True if both inputs are True.",+ "raw": "(&&) : Bool -\u003e Bool -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "right",+ "precedence": 3+ },+ {+ "name": "*",+ "comment": "",+ "raw": "(*) : number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ],+ "associativity": "left",+ "precedence": 7+ },+ {+ "name": "+",+ "comment": "",+ "raw": "(+) : number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ],+ "associativity": "left",+ "precedence": 6+ },+ {+ "name": "-",+ "comment": "",+ "raw": "(-) : number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ],+ "associativity": "left",+ "precedence": 6+ },+ {+ "name": ".",+ "comment": "Function composition: `(f . g == (\\\\x -\u003e f (g x)))`",+ "raw": "(.) : (b -\u003e c) -\u003e (a -\u003e b) -\u003e (a -\u003e c)",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "b",+ "c"+ ],+ [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ "a",+ "c"+ ]+ ]+ ],+ "associativity": "right",+ "precedence": 9+ },+ {+ "name": "/",+ "comment": "Floating point division.",+ "raw": "(/) : Float -\u003e Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 7+ },+ {+ "name": "/=",+ "comment": "",+ "raw": "(/=) : a -\u003e a -\u003e Bool",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "\u003c",+ "comment": "",+ "raw": "(\u003c) : comparable -\u003e comparable -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "\u003c=",+ "comment": "",+ "raw": "(\u003c=) : comparable -\u003e comparable -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "\u003c|",+ "comment": "Function application `f \u003c| x == f x`. This function is useful for avoiding\nparenthesis. Consider the following code to create a text element:\n\n text (monospace (toText \"code\"))\n\nThis can also be written as:\n\n text . monospace \u003c| toText \"code\"",+ "raw": "(\u003c|) : (a -\u003e b) -\u003e a -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ "a",+ "b"+ ]+ ],+ "associativity": "right",+ "precedence": 0+ },+ {+ "name": "==",+ "comment": "",+ "raw": "(==) : a -\u003e a -\u003e Bool",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "\u003e",+ "comment": "",+ "raw": "(\u003e) : comparable -\u003e comparable -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "\u003e=",+ "comment": "",+ "raw": "(\u003e=) : comparable -\u003e comparable -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "non",+ "precedence": 4+ },+ {+ "name": "^",+ "comment": "Exponentiation: `3^2 == 9`",+ "raw": "(^) : number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ],+ "associativity": "left",+ "precedence": 8+ },+ {+ "name": "abs",+ "comment": "Take the absolute value of a number.",+ "raw": "abs : number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ "number"+ ]+ },+ {+ "name": "acos",+ "comment": "",+ "raw": "acos : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "asin",+ "comment": "",+ "raw": "asin : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "atan",+ "comment": "You probably do not want to use this. It takes `(y/x)` as the\nargument, so there is no way to know whether the negative signs comes from\nthe `y` or `x`. Thus, the resulting angle is always between π/2 and -π/2\n(in quadrants I and IV). You probably want to use `atan2` instead.",+ "raw": "atan : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "atan2",+ "comment": "This helps you find the angle of a cartesian coordinate.\nYou will almost certainly want to use this instead of `atan`.\nSo `atan2 y x` computes *atan(y/x)* but also keeps track of which\nquadrant the angle should really be in. The result will be between\nπ and -π, giving you the full range of angles.",+ "raw": "atan2 : Float -\u003e Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "ceiling",+ "comment": "Ceiling function, rounding up.",+ "raw": "ceiling : Float -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "clamp",+ "comment": "Clamps a number within a given range. With the expression\n`clamp 100 200 x` the results are as follows:\n\n 100 if x \u003c 100\n x if 100 \u003c= x \u003c 200\n 200 if 200 \u003c= x",+ "raw": "clamp : number -\u003e number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ]+ ]+ },+ {+ "name": "compare",+ "comment": "Compare any two comparable values. Comparable values include `String`, `Char`,\n`Int`, `Float`, `Time`, or a list or tuple containing comparable values.\nThese are also the only values that work as `Dict` keys or `Set` members.",+ "raw": "compare : comparable -\u003e comparable -\u003e Order",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ [+ "Order"+ ]+ ]+ ]+ },+ {+ "name": "cos",+ "comment": "",+ "raw": "cos : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "curry",+ "comment": "Change how arguments are passed to a function.\nThis splits paired arguments into two separate arguments.",+ "raw": "curry : ((a,b) -\u003e c) -\u003e a -\u003e b -\u003e c",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "_Tuple2",+ "a",+ "b"+ ],+ "c"+ ],+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "c"+ ]+ ]+ ]+ },+ {+ "name": "degrees",+ "comment": "Convert degrees to standard Elm angles (radians).",+ "raw": "degrees : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "div",+ "comment": "Integer division, remainder is discarded.",+ "raw": "div : Int -\u003e Int -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 7+ },+ {+ "name": "e",+ "comment": "An approximation of e.",+ "raw": "e : Float",+ "type": [+ "Float"+ ]+ },+ {+ "name": "flip",+ "comment": "Flips the order of the first two arguments to a function.",+ "raw": "flip : (a -\u003e b -\u003e c) -\u003e (b -\u003e a -\u003e c)",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "c"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "a",+ "c"+ ]+ ]+ ]+ },+ {+ "name": "floor",+ "comment": "Floor function, rounding down.",+ "raw": "floor : Float -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "fromPolar",+ "comment": "Start with polar coordinates (r,θ)\nand get out cartesian coordinates (x,y).",+ "raw": "fromPolar : (Float,Float) -\u003e (Float,Float)",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "fst",+ "comment": "Given a 2-tuple, returns the first value.",+ "raw": "fst : (a,b) -\u003e a",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ "a",+ "b"+ ],+ "a"+ ]+ },+ {+ "name": "id",+ "comment": "Given a value, returns exactly the same value.",+ "raw": "id : a -\u003e a",+ "type": [+ "-\u003e",+ "a",+ "a"+ ]+ },+ {+ "name": "logBase",+ "comment": "Calculate the logarithm of a number with a given base: `logBase 10 100 == 2`",+ "raw": "logBase : number -\u003e number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ "number",+ "number"+ ]+ ]+ },+ {+ "name": "max",+ "comment": "Given two comparables, returns the larger one.",+ "raw": "max : comparable -\u003e comparable -\u003e comparable",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ "comparable"+ ]+ ]+ },+ {+ "name": "min",+ "comment": "Given two comparables, returns the smaller one.",+ "raw": "min : comparable -\u003e comparable -\u003e comparable",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "comparable",+ "comparable"+ ]+ ]+ },+ {+ "name": "mod",+ "comment": "Perform modular arithmetic: ``7 `mod` 2 == 1``",+ "raw": "mod : Int -\u003e Int -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 7+ },+ {+ "name": "not",+ "comment": "Negate a boolean value: `(not True == False)` and `(not False == True)`",+ "raw": "not : Bool -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "otherwise",+ "comment": "Equal to true. Useful as the last case of a multi-way-if.",+ "raw": "otherwise : Bool",+ "type": [+ "Bool"+ ]+ },+ {+ "name": "pi",+ "comment": "An approximation of pi.",+ "raw": "pi : Float",+ "type": [+ "Float"+ ]+ },+ {+ "name": "radians",+ "comment": "Convert radians to standard Elm angles (radians).",+ "raw": "radians : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "rem",+ "comment": "Finds the remainder after dividing one number by another: ``4 `rem` 3 == 1``",+ "raw": "rem : Int -\u003e Int -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 7+ },+ {+ "name": "round",+ "comment": "Round a number to the nearest integer.",+ "raw": "round : Float -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "sin",+ "comment": "",+ "raw": "sin : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "snd",+ "comment": "Given a 2-tuple, returns the second value.",+ "raw": "snd : (a,b) -\u003e b",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ "a",+ "b"+ ],+ "b"+ ]+ },+ {+ "name": "sqrt",+ "comment": "Take the square root of a number.",+ "raw": "sqrt : number -\u003e number",+ "type": [+ "-\u003e",+ "number",+ "number"+ ]+ },+ {+ "name": "tan",+ "comment": "",+ "raw": "tan : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "toFloat",+ "comment": "Convert an integer into a float.",+ "raw": "toFloat : Int -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "toPolar",+ "comment": "Start with cartesian coordinates (x,y)\nand get out polar coordinates (r,θ).",+ "raw": "toPolar : (Float,Float) -\u003e (Float,Float)",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "truncate",+ "comment": "Truncate a decimal number, rounding towards zero.",+ "raw": "truncate : Float -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "turns",+ "comment": "Convert turns to standard Elm angles (radians).\nOne turn is equal to 360°.",+ "raw": "turns : Float -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "uncurry",+ "comment": "Change how arguments are passed to a function.\nThis combines two arguments into a sigle pair.",+ "raw": "uncurry : (a -\u003e b -\u003e c) -\u003e (a,b) -\u003e c",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "c"+ ]+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ "a",+ "b"+ ],+ "c"+ ]+ ]+ },+ {+ "name": "xor",+ "comment": "The exclusive-or operator. True if exactly one input is True.",+ "raw": "xor : Bool -\u003e Bool -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "|\u003e",+ "comment": "Forward function application `x |\u003e f == f x`. This function is useful\nfor avoiding parenthesis and writing code in a more natural way.\nConsider the following code to create a pentagon:\n\n scale 2 (move (10,10) (filled blue (ngon 5 30)))\n\nThis can also be written as:\n\n ngon 5 30 |\u003e filled blue\n |\u003e move (10,10)\n |\u003e scale 2",+ "raw": "(|\u003e) : a -\u003e (a -\u003e b) -\u003e b",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ "b"+ ]+ ],+ "associativity": "left",+ "precedence": 0+ },+ {+ "name": "||",+ "comment": "The or operator. True if one or both inputs are True.",+ "raw": "(||) : Bool -\u003e Bool -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "Bool"+ ]+ ]+ ],+ "associativity": "right",+ "precedence": 2+ }+ ]+},+{+ "name": "Char",+ "document": "Functions for working with characters. Character literals are enclosed in\n`'a'` pair of single quotes.\n\n# Classification\n@docs isUpper, isLower, isDigit, isOctDigit, isHexDigit\n\n# Conversion\n@docs toUpper, toLower, toLocaleUpper, toLocaleLower, toCode, fromCode",+ "aliases": [+ {+ "name": "KeyCode",+ "comment": "",+ "raw": "type KeyCode = Int",+ "typeVariables": [],+ "type": [+ "Int"+ ]+ }+ ],+ "datatypes": [],+ "values": [+ {+ "name": "fromCode",+ "comment": "Convert from unicode.",+ "raw": "fromCode : KeyCode -\u003e Char",+ "type": [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "Char"+ ]+ ]+ },+ {+ "name": "isDigit",+ "comment": "True for ASCII digits `[0-9]`.",+ "raw": "isDigit : Char -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isHexDigit",+ "comment": "True for ASCII hexadecimal digits `[0-9a-fA-F]`.",+ "raw": "isHexDigit : Char -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isLower",+ "comment": "True for lower case letters.",+ "raw": "isLower : Char -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isOctDigit",+ "comment": "True for ASCII octal digits `[0-7]`.",+ "raw": "isOctDigit : Char -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isUpper",+ "comment": "True for upper case letters.",+ "raw": "isUpper : Char -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "toCode",+ "comment": "Convert to unicode. Used with the [`Keyboard`](/docs/Keyboard.elm)\nlibrary, which expects the input to be uppercase.",+ "raw": "toCode : Char -\u003e KeyCode",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "KeyCode"+ ]+ ]+ },+ {+ "name": "toLocaleLower",+ "comment": "Convert to lower case, according to any locale-specific case mappings.",+ "raw": "toLocaleLower : Char -\u003e Char",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Char"+ ]+ ]+ },+ {+ "name": "toLocaleUpper",+ "comment": "Convert to upper case, according to any locale-specific case mappings.",+ "raw": "toLocaleUpper : Char -\u003e Char",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Char"+ ]+ ]+ },+ {+ "name": "toLower",+ "comment": "Convert to lower case.",+ "raw": "toLower : Char -\u003e Char",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Char"+ ]+ ]+ },+ {+ "name": "toUpper",+ "comment": "Convert to upper case.",+ "raw": "toUpper : Char -\u003e Char",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Char"+ ]+ ]+ }+ ]+},+{+ "name": "Color",+ "document": "Library for working with colors. Includes\n[RGB](https://en.wikipedia.org/wiki/RGB_color_model) and\n[HSV](http://en.wikipedia.org/wiki/HSL_and_HSV) creation, gradients, and\nbuilt-in names.\n\n# Creation\n@docs rgb, rgba, hsv, hsva, greyscale, grayscale\n\n# From Other Colors\n@docs complement\n\n# Gradients\n@docs linear, radial\n\n# Built-in Colors\nThese colors come from the [Tango\npalette](http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines)\nwhich provides aesthetically reasonable defaults for colors. Each color also\ncomes with a light and dark version.\n\n### Standard\n@docs red, orange, yellow, green, blue, purple, brown\n\n### Light\n@docs lightRed, lightOrange, lightYellow, lightGreen, lightBlue, lightPurple,\n lightBrown\n\n### Dark\n@docs darkRed, darkOrange, darkYellow, darkGreen, darkBlue, darkPurple,\n darkBrown\n\n### Eight Shades of Grey\nThese colors are a compatible series of shades of grey, fitting nicely\nwith the Tango palette.\n@docs white, lightGrey, grey, darkGrey, lightCharcoal, charcoal, darkCharcoal, black\n\nThese are identical to the *grey* versions. It seems the spelling is regional, but\nthat has never helped me remember which one I should be writing.\n@docs lightGray, gray, darkGray",+ "aliases": [],+ "datatypes": [+ {+ "name": "Color",+ "comment": "",+ "raw": "data Color = Color Int Int Int Float",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Color",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ]+ ]+ ]+ }+ ]+ },+ {+ "name": "Gradient",+ "comment": "",+ "raw": "data Gradient\n = Linear (Float,Float) (Float,Float) [(Float,Color)]\n | Radial (Float,Float) Float (Float,Float) Float [(Float,Color)]",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Linear",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ],+ [+ "Gradient"+ ]+ ]+ ]+ ]+ },+ {+ "name": "Radial",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ],+ [+ "Gradient"+ ]+ ]+ ]+ ]+ ]+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "black",+ "comment": "",+ "raw": "black : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "blue",+ "comment": "",+ "raw": "blue : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "brown",+ "comment": "",+ "raw": "brown : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "charcoal",+ "comment": "",+ "raw": "charcoal : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "complement",+ "comment": "Produce a “complementary color”.\nThe two colors will accent each other.",+ "raw": "complement : Color -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "Color"+ ]+ ]+ },+ {+ "name": "darkBlue",+ "comment": "",+ "raw": "darkBlue : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkBrown",+ "comment": "",+ "raw": "darkBrown : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkCharcoal",+ "comment": "",+ "raw": "darkCharcoal : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkGray",+ "comment": "",+ "raw": "darkGray : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkGreen",+ "comment": "",+ "raw": "darkGreen : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkGrey",+ "comment": "",+ "raw": "darkGrey : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkOrange",+ "comment": "",+ "raw": "darkOrange : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkPurple",+ "comment": "",+ "raw": "darkPurple : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkRed",+ "comment": "",+ "raw": "darkRed : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "darkYellow",+ "comment": "",+ "raw": "darkYellow : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "gray",+ "comment": "",+ "raw": "gray : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "grayscale",+ "comment": "Produce a gray based on the input. 0 is white, 1 is black.",+ "raw": "grayscale : Float -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ },+ {+ "name": "green",+ "comment": "",+ "raw": "green : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "grey",+ "comment": "",+ "raw": "grey : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "greyscale",+ "comment": "",+ "raw": "greyscale : Float -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ },+ {+ "name": "hsv",+ "comment": "Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV). This is very\nconvenient for creating colors that cycle and shift. Hue is an angle and should\nbe given in standard Elm angles (radians).",+ "raw": "hsv : Float -\u003e Float -\u003e Float -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ]+ ]+ },+ {+ "name": "hsva",+ "comment": "Create [HSV colors](http://en.wikipedia.org/wiki/HSL_and_HSV)\nwith an alpha component for transparency.",+ "raw": "hsva : Float -\u003e Float -\u003e Float -\u003e Float -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lightBlue",+ "comment": "",+ "raw": "lightBlue : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightBrown",+ "comment": "",+ "raw": "lightBrown : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightCharcoal",+ "comment": "",+ "raw": "lightCharcoal : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightGray",+ "comment": "",+ "raw": "lightGray : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightGreen",+ "comment": "",+ "raw": "lightGreen : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightGrey",+ "comment": "",+ "raw": "lightGrey : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightOrange",+ "comment": "",+ "raw": "lightOrange : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightPurple",+ "comment": "",+ "raw": "lightPurple : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightRed",+ "comment": "",+ "raw": "lightRed : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "lightYellow",+ "comment": "",+ "raw": "lightYellow : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "linear",+ "comment": "Create a linear gradient. Takes a start and end point and then a series of\n“color stops” that indicate how to interpolate between the start and\nend points. See [this example](/edit/examples/Elements/LinearGradient.elm) for a\nmore visual explanation.",+ "raw": "linear : (number, number) -\u003e (number, number) -\u003e [(Float,Color)] -\u003e Gradient",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ "number",+ "number"+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ "number",+ "number"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ],+ [+ "Gradient"+ ]+ ]+ ]+ ]+ },+ {+ "name": "orange",+ "comment": "",+ "raw": "orange : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "purple",+ "comment": "",+ "raw": "purple : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "radial",+ "comment": "Create a radial gradient. First takes a start point and inner radius. Then\ntakes an end point and outer radius. It then takes a series of “color\nstops” that indicate how to interpolate between the inner and outer\ncircles. See [this example](/edit/examples/Elements/RadialGradient.elm) for a\nmore visual explanation.",+ "raw": "radial : (number,number) -\u003e number -\u003e (number,number) -\u003e number -\u003e [(Float,Color)] -\u003e Gradient",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ "number",+ "number"+ ],+ [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "_Tuple2",+ "number",+ "number"+ ],+ [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ],+ [+ "Gradient"+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "red",+ "comment": "",+ "raw": "red : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "rgb",+ "comment": "Create RGB colors from numbers between 0 and 255 inclusive.",+ "raw": "rgb : Int -\u003e Int -\u003e Int -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Color"+ ]+ ]+ ]+ ]+ },+ {+ "name": "rgba",+ "comment": "Create RGB colors with an alpha component for transparency.\nThe alpha component is specified with numbers between 0 and 1.",+ "raw": "rgba : Int -\u003e Int -\u003e Int -\u003e Float -\u003e Color",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Color"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "white",+ "comment": "",+ "raw": "white : Color",+ "type": [+ "Color"+ ]+ },+ {+ "name": "yellow",+ "comment": "",+ "raw": "yellow : Color",+ "type": [+ "Color"+ ]+ }+ ]+},+{+ "name": "Date",+ "document": "Library for working with dates. Email the mailing list if you encounter\nissues with internationalization or locale formatting.\n\n# Conversions\n@docs read, toTime\n\n# Extractions\n@docs year, month, Month, day, dayOfWeek, Day, hour, minute, second",+ "aliases": [],+ "datatypes": [+ {+ "name": "Date",+ "comment": "",+ "raw": "data Date = Date",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Date",+ "type": [+ "Date"+ ]+ }+ ]+ },+ {+ "name": "Day",+ "comment": "Represents the days of the week.",+ "raw": "data Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Mon",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Tue",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Wed",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Thu",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Fri",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Sat",+ "type": [+ "Day"+ ]+ },+ {+ "name": "Sun",+ "type": [+ "Day"+ ]+ }+ ]+ },+ {+ "name": "Month",+ "comment": "Represents the month of the year.",+ "raw": "data Month = Jan | Feb | Mar | Apr\n | May | Jun | Jul | Aug\n | Sep | Oct | Nov | Dec",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Jan",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Feb",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Mar",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Apr",+ "type": [+ "Month"+ ]+ },+ {+ "name": "May",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Jun",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Jul",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Aug",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Sep",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Oct",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Nov",+ "type": [+ "Month"+ ]+ },+ {+ "name": "Dec",+ "type": [+ "Month"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "day",+ "comment": "Extract the day of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the integer `23`.",+ "raw": "day : Date -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "dayOfWeek",+ "comment": "Extract the day of the week for a given date. Given the date 23 June\n1990 at 11:45AM this returns the Day `Thu` as defined below.",+ "raw": "dayOfWeek : Date -\u003e Day",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Day"+ ]+ ]+ },+ {+ "name": "hour",+ "comment": "Extract the hour of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the integer `11`.",+ "raw": "hour : Date -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "minute",+ "comment": "Extract the minute of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the integer `45`.",+ "raw": "minute : Date -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "month",+ "comment": "Extract the month of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the Month `Jun` as defined below.",+ "raw": "month : Date -\u003e Month",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Month"+ ]+ ]+ },+ {+ "name": "read",+ "comment": "Attempt to read a date from a string.",+ "raw": "read : String -\u003e Maybe Date",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "Date"+ ]+ ]+ ]+ },+ {+ "name": "second",+ "comment": "Extract the second of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the integer `0`.",+ "raw": "second : Date -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "toTime",+ "comment": "Convert a date into a time since midnight (UTC) of 1 January 1990 (i.e.\n[UNIX time](http://en.wikipedia.org/wiki/Unix_time)). Given the date 23 June\n1990 at 11:45AM this returns the corresponding time.",+ "raw": "toTime : Date -\u003e Time",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Time"+ ]+ ]+ },+ {+ "name": "year",+ "comment": "Extract the year of a given date. Given the date 23 June 1990 at 11:45AM\nthis returns the integer `1990`.",+ "raw": "year : Date -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Date"+ ],+ [+ "Int"+ ]+ ]+ }+ ]+},+{+ "name": "Dict",+ "document": "A dictionary mapping unique keys to values. The keys can be any comparable\ntype. This includes `Int`, `Float`, `Time`, `Char`, `String`, and tuples or\nlists of comparable types.\n\nInsert, remove, and query operations all take *O(log n)* time.\n\n# Build\n@docs empty, singleton, insert, remove\n\n# Query\n@docs member, lookup, findWithDefault\n\n# Combine\n@docs union, intersect, diff\n\n# Lists\n@docs keys, values, toList, fromList\n\n# Transform\n@docs map, foldl, foldr",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "diff",+ "comment": "Keep a key-value pair when its key does not appear in the second dictionary.\nPreference is given to the first dictionary.",+ "raw": "diff : Dict comparable v -\u003e Dict comparable v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "empty",+ "comment": "Create an empty dictionary.",+ "raw": "empty : Dict comparable v",+ "type": [+ "Dict",+ "comparable",+ "v"+ ]+ },+ {+ "name": "findWithDefault",+ "comment": "Find the value associated with a key. If the key is not found,\nreturn the default value.",+ "raw": "findWithDefault : v -\u003e comparable -\u003e Dict comparable v -\u003e v",+ "type": [+ "-\u003e",+ "v",+ [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ "v"+ ]+ ]+ ]+ },+ {+ "name": "foldl",+ "comment": "Fold over the key-value pairs in a dictionary, in order from lowest\nkey to highest key.",+ "raw": "foldl : (comparable -\u003e v -\u003e b -\u003e b) -\u003e b -\u003e Dict comparable v -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "v",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "foldr",+ "comment": "Fold over the key-value pairs in a dictionary, in order from highest\nkey to lowest key.",+ "raw": "foldr : (comparable -\u003e v -\u003e b -\u003e b) -\u003e b -\u003e Dict comparable v -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "v",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "fromList",+ "comment": "Convert an association list into a dictionary.",+ "raw": "fromList : [(comparable,v)] -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ "comparable",+ "v"+ ]+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ },+ {+ "name": "insert",+ "comment": "Insert a key-value pair into a dictionary. Replaces value when there is\na collision.",+ "raw": "insert : comparable -\u003e v -\u003e Dict comparable v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "v",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ ]+ },+ {+ "name": "intersect",+ "comment": "Keep a key-value pair when its key appears in the second dictionary.\nPreference is given to values in the first dictionary.",+ "raw": "intersect : Dict comparable v -\u003e Dict comparable v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "keys",+ "comment": "Get all of the keys in a dictionary.",+ "raw": "keys : Dict comparable v -\u003e [comparable]",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "_List",+ "comparable"+ ]+ ]+ },+ {+ "name": "lookup",+ "comment": "Lookup the value associated with a key.",+ "raw": "lookup : comparable -\u003e Dict comparable v -\u003e Maybe v",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Maybe",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "map",+ "comment": "Apply a function to all values in a dictionary.",+ "raw": "map : (a -\u003e b) -\u003e Dict comparable a -\u003e Dict comparable b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "a"+ ],+ [+ "Dict",+ "comparable",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "member",+ "comment": "Determine if a key is in a dictionary.",+ "raw": "member : comparable -\u003e Dict comparable v -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "remove",+ "comment": "Remove a key-value pair from a dictionary. If the key is not found,\nno changes are made.",+ "raw": "remove : comparable -\u003e Dict comparable v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "singleton",+ "comment": "Create a dictionary with one key-value pair.",+ "raw": "singleton : comparable -\u003e v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "v",+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "toList",+ "comment": "Convert a dictionary into an association list of key-value pairs.",+ "raw": "toList : Dict comparable v -\u003e [(comparable,v)]",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "_List",+ [+ "_Tuple2",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "union",+ "comment": "Combine two dictionaries. If there is a collision, preference is given\nto the first dictionary.",+ "raw": "union : Dict comparable v -\u003e Dict comparable v -\u003e Dict comparable v",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "Dict",+ "comparable",+ "v"+ ]+ ]+ ]+ },+ {+ "name": "values",+ "comment": "Get all of the values in a dictionary.",+ "raw": "values : Dict comparable v -\u003e [v]",+ "type": [+ "-\u003e",+ [+ "Dict",+ "comparable",+ "v"+ ],+ [+ "_List",+ "v"+ ]+ ]+ }+ ]+},+{+ "name": "Either",+ "document": "Represents any data that can take two different types.\n\n# Type and Constructors\n@docs Either\n\n# Taking Eithers apart\n@docs either, isLeft, isRight\n\n# Eithers and Lists\n@docs lefts, rights, partition",+ "aliases": [],+ "datatypes": [+ {+ "name": "Either",+ "comment": "Represents any data may take two forms. For example, a user ID may be\neither an `Int` or a `String`.\n\nThis can also be used for error handling `(Either String a)` where\nerror messages are stored on the left, and the correct values\n(“right” values) are stored on the right.",+ "raw": "data Either a b = Left a | Right b",+ "typeVariables": [+ "a",+ "b"+ ],+ "constructors": [+ {+ "name": "Left",+ "type": [+ "-\u003e",+ "a",+ [+ "Either",+ "a",+ "b"+ ]+ ]+ },+ {+ "name": "Right",+ "type": [+ "-\u003e",+ "b",+ [+ "Either",+ "a",+ "b"+ ]+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "either",+ "comment": "Apply the first function to a `Left` and the second function to a `Right`.\nThis allows the extraction of a value from an `Either`.",+ "raw": "either : (a -\u003e c) -\u003e (b -\u003e c) -\u003e Either a b -\u003e c",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "c"+ ],+ [+ "-\u003e",+ [+ "-\u003e",+ "b",+ "c"+ ],+ [+ "-\u003e",+ [+ "Either",+ "a",+ "b"+ ],+ "c"+ ]+ ]+ ]+ },+ {+ "name": "isLeft",+ "comment": "True if the value is a `Left`.",+ "raw": "isLeft : Either a b -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Either",+ "a",+ "b"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isRight",+ "comment": "True if the value is a `Right`.",+ "raw": "isRight : Either a b -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Either",+ "a",+ "b"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "lefts",+ "comment": "Keep only the values held in `Left` values.",+ "raw": "lefts : [Either a b] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Either",+ "a",+ "b"+ ]+ ],+ [+ "_List",+ "a"+ ]+ ]+ },+ {+ "name": "partition",+ "comment": "Split into two lists, lefts on the left and rights on the right. So we\nhave the equivalence: `(partition es == (lefts es, rights es))`",+ "raw": "partition : [Either a b] -\u003e ([a],[b])",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Either",+ "a",+ "b"+ ]+ ],+ [+ "_Tuple2",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "rights",+ "comment": "Keep only the values held in `Right` values.",+ "raw": "rights : [Either a b] -\u003e [b]",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Either",+ "a",+ "b"+ ]+ ],+ [+ "_List",+ "b"+ ]+ ]+ }+ ]+},+{+ "name": "Http",+ "document": "A library for asynchronous HTTP requests. See the\n[WebSocket](http://elm-lang.org/docs/WebSocket.elm) library if\nyou have very strict latency requirements.\n\n# Sending Requests\n@docs send, sendGet\n\n# Creating Requests\n@docs get, post, request\n\n# Responses\n@docs Response",+ "aliases": [+ {+ "name": "Request",+ "comment": "",+ "raw": "type Request a = {\n verb : String,\n url : String,\n body : a,\n headers : [(String,String)]\n }",+ "typeVariables": [+ "a"+ ],+ "type": {+ "headers": [+ "_List",+ [+ "_Tuple2",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ],+ "body": "a",+ "url": [+ "String"+ ],+ "verb": [+ "String"+ ]+ }+ }+ ],+ "datatypes": [+ {+ "name": "Response",+ "comment": "The datatype for responses. Success contains only the returned message.\nFailures contain both an error code and an error message.",+ "raw": "data Response a = Success a | Waiting | Failure Int String",+ "typeVariables": [+ "a"+ ],+ "constructors": [+ {+ "name": "Success",+ "type": [+ "-\u003e",+ "a",+ [+ "Response",+ "a"+ ]+ ]+ },+ {+ "name": "Waiting",+ "type": [+ "Response",+ "a"+ ]+ },+ {+ "name": "Failure",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Response",+ "a"+ ]+ ]+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "get",+ "comment": "Create a GET request to the given url.",+ "raw": "get : String -\u003e Request String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Request",+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "post",+ "comment": "Create a POST request to the given url, carrying the given data.",+ "raw": "post : String -\u003e String -\u003e Request String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Request",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "request",+ "comment": "Create a customized request. Arguments are request type (get, post, put,\ndelete, etc.), target url, data, and a list of additional headers.",+ "raw": "request : String -\u003e String -\u003e String -\u003e [(String,String)] -\u003e Request String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ],+ [+ "Request",+ [+ "String"+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "send",+ "comment": "Performs an HTTP request with the given requests. Produces a signal\nthat carries the responses.",+ "raw": "send : Signal (Request a) -\u003e Signal (Response String)",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "Request",+ "a"+ ]+ ],+ [+ "Signal",+ [+ "Response",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "sendGet",+ "comment": "Performs an HTTP GET request with the given urls. Produces a signal\nthat carries the responses.",+ "raw": "sendGet : Signal String -\u003e Signal (Response String)",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "String"+ ]+ ],+ [+ "Signal",+ [+ "Response",+ [+ "String"+ ]+ ]+ ]+ ]+ }+ ]+},+{+ "name": "JavaScript",+ "document": "This library does basic conversions between Elm and JS values. This allows\nthe internal data structures of Elm to change and improve with no impact on JS\nintegration.\n\n# Javascript to Elm\n@docs toString, toInt, toFloat, toBool, toList\n\n# JavaScript from Elm\n@docs fromString, fromInt, fromFloat, fromBool, fromList",+ "aliases": [],+ "datatypes": [+ {+ "name": "JSArray",+ "comment": "",+ "raw": "data JSArray a = JSArray a",+ "typeVariables": [+ "a"+ ],+ "constructors": [+ {+ "name": "JSArray",+ "type": [+ "-\u003e",+ "a",+ [+ "JSArray",+ "a"+ ]+ ]+ }+ ]+ },+ {+ "name": "JSBool",+ "comment": "",+ "raw": "data JSBool = JSBool",+ "typeVariables": [],+ "constructors": [+ {+ "name": "JSBool",+ "type": [+ "JSBool"+ ]+ }+ ]+ },+ {+ "name": "JSDomNode",+ "comment": "",+ "raw": "data JSDomNode = JSDomNode",+ "typeVariables": [],+ "constructors": [+ {+ "name": "JSDomNode",+ "type": [+ "JSDomNode"+ ]+ }+ ]+ },+ {+ "name": "JSNumber",+ "comment": "",+ "raw": "data JSNumber = JSNumber",+ "typeVariables": [],+ "constructors": [+ {+ "name": "JSNumber",+ "type": [+ "JSNumber"+ ]+ }+ ]+ },+ {+ "name": "JSObject",+ "comment": "",+ "raw": "data JSObject = JSObject",+ "typeVariables": [],+ "constructors": [+ {+ "name": "JSObject",+ "type": [+ "JSObject"+ ]+ }+ ]+ },+ {+ "name": "JSString",+ "comment": "",+ "raw": "data JSString = JSString",+ "typeVariables": [],+ "constructors": [+ {+ "name": "JSString",+ "type": [+ "JSString"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "fromBool",+ "comment": "",+ "raw": "fromBool : Bool -\u003e JSBool",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "JSBool"+ ]+ ]+ },+ {+ "name": "fromFloat",+ "comment": "",+ "raw": "fromFloat : Float -\u003e JSNumber",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "JSNumber"+ ]+ ]+ },+ {+ "name": "fromInt",+ "comment": "",+ "raw": "fromInt : Int -\u003e JSNumber",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "JSNumber"+ ]+ ]+ },+ {+ "name": "fromList",+ "comment": "Produces a uniform JavaScript array with all members of the same type.",+ "raw": "fromList : [a] -\u003e JSArray a",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "JSArray",+ "a"+ ]+ ]+ },+ {+ "name": "fromString",+ "comment": "",+ "raw": "fromString : String -\u003e JSString",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "JSString"+ ]+ ]+ },+ {+ "name": "toBool",+ "comment": "",+ "raw": "toBool : JSBool -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "JSBool"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "toFloat",+ "comment": "",+ "raw": "toFloat : JSNumber -\u003e Float",+ "type": [+ "-\u003e",+ [+ "JSNumber"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "toInt",+ "comment": "",+ "raw": "toInt : JSNumber -\u003e Int",+ "type": [+ "-\u003e",+ [+ "JSNumber"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "toList",+ "comment": "Requires that the input array be uniform (all members have the same type)",+ "raw": "toList : JSArray a -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "JSArray",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ },+ {+ "name": "toString",+ "comment": "",+ "raw": "toString : JSString -\u003e String",+ "type": [+ "-\u003e",+ [+ "JSString"+ ],+ [+ "String"+ ]+ ]+ }+ ]+},+{+ "name": "Json",+ "document": "Library for working with [JSON](https://en.wikipedia.org/wiki/JSON) values.\n\n# Strings\n@docs fromString, toString\n\n# JS Strings\n@docs fromJSString, toJSString\n\n# JS Objects\n@docs fromJSObject, toJSObject",+ "aliases": [],+ "datatypes": [+ {+ "name": "JsonValue",+ "comment": "This datatype can represent all valid values that can be held in a JSON\nobject. In Elm, a proper JSON object is represented as a (Dict String JsonValue)\nwhich is a mapping from strings to Json Values.",+ "raw": "data JsonValue\n = String String\n | Number Float\n | Boolean Bool\n | Null\n | Array [JsonValue]\n | Object (Dict.Dict String JsonValue)",+ "typeVariables": [],+ "constructors": [+ {+ "name": "String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "JsonValue"+ ]+ ]+ },+ {+ "name": "Number",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "JsonValue"+ ]+ ]+ },+ {+ "name": "Boolean",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "JsonValue"+ ]+ ]+ },+ {+ "name": "Null",+ "type": [+ "JsonValue"+ ]+ },+ {+ "name": "Array",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "JsonValue"+ ]+ ],+ [+ "JsonValue"+ ]+ ]+ },+ {+ "name": "Object",+ "type": [+ "-\u003e",+ [+ "Dict.Dict",+ [+ "String"+ ],+ [+ "JsonValue"+ ]+ ],+ [+ "JsonValue"+ ]+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "fromJSObject",+ "comment": "Convert a JS object into a `JsonValue`.",+ "raw": "fromJSObject : JSObject -\u003e JsonValue",+ "type": [+ "-\u003e",+ [+ "JSObject"+ ],+ [+ "JsonValue"+ ]+ ]+ },+ {+ "name": "fromJSString",+ "comment": "Parse a JavaScript string representation of a proper JSON object into\nits Elm representation.",+ "raw": "fromJSString : JSString -\u003e Maybe JsonValue",+ "type": [+ "-\u003e",+ [+ "JSString"+ ],+ [+ "Maybe",+ [+ "JsonValue"+ ]+ ]+ ]+ },+ {+ "name": "fromString",+ "comment": "Parse a string representation of a proper JSON object into\nits Elm representation.",+ "raw": "fromString : String -\u003e Maybe JsonValue",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "JsonValue"+ ]+ ]+ ]+ },+ {+ "name": "toJSObject",+ "comment": "Convert a `JsonValue` into a `JSObject`. Paired with the\n[`JavaScript.Experimental` library](/docs/JavaScript/Experimental.elm),\nThis lets you convert strings into Elm records:\n\n import JavaScript.Experimental as JS\n\n stringToRecord str =\n case fromString str of\n Just jsonValue -\u003e Just (JS.toRecord (toJSObject jsonValue))\n Nothing -\u003e Nothing",+ "raw": "toJSObject : JsonValue -\u003e JSObject",+ "type": [+ "-\u003e",+ [+ "JsonValue"+ ],+ [+ "JSObject"+ ]+ ]+ },+ {+ "name": "toJSString",+ "comment": "Convert a proper JSON object into a JavaScript string.\nNote that the type JSString seen here is not the same as the type constructor\nJsonString used elsewhere in this module.",+ "raw": "toJSString : String -\u003e JsonValue -\u003e JSString",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "JsonValue"+ ],+ [+ "JSString"+ ]+ ]+ ]+ },+ {+ "name": "toString",+ "comment": "Convert a `JsonValue` into a prettified string.\nThe first argument is a separator token (e.g. \\\" \\\", \\\"\\\\n\\\", etc.) that will\nbe used for indentation in the prettified string version of the JSON.",+ "raw": "toString : String -\u003e JsonValue -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "JsonValue"+ ],+ [+ "String"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Keyboard",+ "document": "Library for working with keyboard input.\n\n# Representing Keys\n@docs KeyCode\n\n# Directions\n@docs arrows, wasd, directions\n\n# Specific Keys\n@docs shift, enter, space, ctrl\n\n# General Keypresses\n@docs isDown, keysDown, lastPressed",+ "aliases": [+ {+ "name": "KeyCode",+ "comment": "Type alias to make it clearer what integers are supposed to represent\nin this library. Use [`Char.toCode`](docs/Char.elm#toCode) and\n[`Char.fromCode`](/docs/Char.elm#fromCode) to convert key codes to characters.\nUse the uppercase character with `toCode`.",+ "raw": "type KeyCode = Int",+ "typeVariables": [],+ "type": [+ "Int"+ ]+ }+ ],+ "datatypes": [],+ "values": [+ {+ "name": "arrows",+ "comment": "A signal of records indicating which arrow keys are pressed.\n\n`{ x = 0, y = 0 }` when pressing no arrows.\u003cbr\u003e\n`{ x =-1, y = 0 }` when pressing the left arrow.\u003cbr\u003e\n`{ x = 1, y = 1 }` when pressing the up and right arrows.\u003cbr\u003e\n`{ x = 0, y =-1 }` when pressing the down, left, and right arrows.",+ "raw": "arrows : Signal { x:Int, y:Int }",+ "type": [+ "Signal",+ {+ "y": [+ "Int"+ ],+ "x": [+ "Int"+ ]+ }+ ]+ },+ {+ "name": "ctrl",+ "comment": "Whether the control key is pressed.",+ "raw": "ctrl : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "directions",+ "comment": "Custom key directions to support different locales. The order is up, down,\nleft, right.",+ "raw": "directions : KeyCode -\u003e KeyCode -\u003e KeyCode -\u003e KeyCode -\u003e Signal { x:Int, y:Int }",+ "type": [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "Signal",+ {+ "y": [+ "Int"+ ],+ "x": [+ "Int"+ ]+ }+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "enter",+ "comment": "Whether the enter key is pressed.",+ "raw": "enter : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isDown",+ "comment": "Whether an arbitrary key is pressed.",+ "raw": "isDown : KeyCode -\u003e Signal Bool",+ "type": [+ "-\u003e",+ [+ "KeyCode"+ ],+ [+ "Signal",+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "keysDown",+ "comment": "List of keys that are currently down.",+ "raw": "keysDown : Signal [KeyCode]",+ "type": [+ "Signal",+ [+ "_List",+ [+ "KeyCode"+ ]+ ]+ ]+ },+ {+ "name": "lastPressed",+ "comment": "The latest key that has been pressed.",+ "raw": "lastPressed : Signal KeyCode",+ "type": [+ "Signal",+ [+ "KeyCode"+ ]+ ]+ },+ {+ "name": "shift",+ "comment": "Whether the shift key is pressed.",+ "raw": "shift : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "space",+ "comment": "Whether the space key is pressed.",+ "raw": "space : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "wasd",+ "comment": "Just like the arrows signal, but this uses keys w, a, s, and d,\nwhich are common controls for many computer games.",+ "raw": "wasd : Signal { x:Int, y:Int }",+ "type": [+ "Signal",+ {+ "y": [+ "Int"+ ],+ "x": [+ "Int"+ ]+ }+ ]+ }+ ]+},+{+ "name": "List",+ "document": "A library for manipulating lists of values. Every value in a\nlist must have the same type.\n\n# Basics\n@docs (::), (++), isEmpty, length, reverse, map\n\n# Sub-lists\n@docs head, tail, last, filter, take, drop\n\n# Putting Lists Together\n@docs concat, concatMap, join, intersperse, zip, zipWith\n\n# Taking Lists Apart\n@docs partition, unzip\n\n# Folds\n@docs foldr, foldl, foldr1, foldl1, scanl, scanl1\n\n# Special Folds\n@docs sum, product, maximum, minimum, all, any, and, or",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "++",+ "comment": "Puts two appendable things together:\n\n [1,1] ++ [2,3] == [1,1,2,3]\n \"abc\" ++ \"123\" == \"abc123\"",+ "raw": "(++) : appendable -\u003e appendable -\u003e appendable",+ "type": [+ "-\u003e",+ "appendable",+ [+ "-\u003e",+ "appendable",+ "appendable"+ ]+ ],+ "associativity": "right",+ "precedence": 5+ },+ {+ "name": "::",+ "comment": "Add an element to the front of a list `(1 :: [2,3] == [1,2,3])`",+ "raw": "(::) : a -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ],+ "associativity": "right",+ "precedence": 5+ },+ {+ "name": "all",+ "comment": "Check to see if all elements satisfy the predicate.",+ "raw": "all : (a -\u003e Bool) -\u003e [a] -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "and",+ "comment": "Check to see if all elements are True.",+ "raw": "and : [Bool] -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Bool"+ ]+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "any",+ "comment": "Check to see if any elements satisfy the predicate.",+ "raw": "any : (a -\u003e Bool) -\u003e [a] -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "concat",+ "comment": "Concatenate a list of appendable things:\n\n concat [[1,2],[3],[4,5]] == [1,2,3,4,5]\n concat [\"tree\",\"house\"] == \"treehouse\"",+ "raw": "concat : [appendable] -\u003e appendable",+ "type": [+ "-\u003e",+ [+ "_List",+ "appendable"+ ],+ "appendable"+ ]+ },+ {+ "name": "concatMap",+ "comment": "Map a given function onto a list and flatten the resulting lists.\n\n concatMap f xs == concat (map f xs)",+ "raw": "concatMap : (a -\u003e appendable) -\u003e [a] -\u003e appendable",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "appendable"+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "appendable"+ ]+ ]+ },+ {+ "name": "drop",+ "comment": "Drop the first n members of a list: `(drop 2 [1,2,3,4] == [3,4])`",+ "raw": "drop : Int -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "filter",+ "comment": "Keep only elements that satisfy the predicate:\n`(filter isEven [1..6] == [2,4,6])`",+ "raw": "filter : (a -\u003e Bool) -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "foldl",+ "comment": "Reduce a list from the left: `(foldl (::) [] [1,2,3] == [3,2,1])`",+ "raw": "foldl : (a -\u003e b -\u003e b) -\u003e b -\u003e [a] -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "foldl1",+ "comment": "Reduce a list from the left without a base case. List must be non-empty.",+ "raw": "foldl1 : (a -\u003e a -\u003e a) -\u003e [a] -\u003e a",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "a",+ "a"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "a"+ ]+ ]+ },+ {+ "name": "foldr",+ "comment": "Reduce a list from the right: `(foldr (+) 0 [1,2,3] == 6)`",+ "raw": "foldr : (a -\u003e b -\u003e b) -\u003e b -\u003e [a] -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "foldr1",+ "comment": "Reduce a list from the right without a base case. List must be non-empty.",+ "raw": "foldr1 : (a -\u003e a -\u003e a) -\u003e [a] -\u003e a",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "a",+ "a"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "a"+ ]+ ]+ },+ {+ "name": "head",+ "comment": "Extract the first element of a list. List must be non-empty.\n`(head [1,2,3] == 1)`",+ "raw": "head : [a] -\u003e a",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "a"+ ]+ },+ {+ "name": "intersperse",+ "comment": "Places the given value between all members of the given list.\n\n intersperse \"on\" [\"turtles\",\"turtles\",\"turtles\"] == [\"turtles\",\"on\",\"turtles\",\"on\",\"turtles\"]",+ "raw": "intersperse : a -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "isEmpty",+ "comment": "Check if a list is empty `(isEmpty [] == True)`",+ "raw": "isEmpty : [a] -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "join",+ "comment": "Places the given value between all of the lists in the second\nargument and concatenates the result.\n\n join \"a\" [\"H\",\"w\",\"ii\",\"n\"] == \"Hawaiian\"",+ "raw": "join : appendable -\u003e [appendable] -\u003e appendable",+ "type": [+ "-\u003e",+ "appendable",+ [+ "-\u003e",+ [+ "_List",+ "appendable"+ ],+ "appendable"+ ]+ ]+ },+ {+ "name": "last",+ "comment": "Extract the last element of a list. List must be non-empty.\n`(last [1,2,3] == 3)`",+ "raw": "last : [a] -\u003e a",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ "a"+ ]+ },+ {+ "name": "length",+ "comment": "Determine the length of a list: `(length [1,2,3] == 3)`",+ "raw": "length : [a] -\u003e Int",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "map",+ "comment": "Apply a function to every element of a list: `(map sqrt [1,4,9] == [1,2,3])`",+ "raw": "map : (a -\u003e b) -\u003e [a] -\u003e [b]",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "maximum",+ "comment": "Find the maximum element in a non-empty list: `maximum [1,4,2] == 4`",+ "raw": "maximum : [comparable] -\u003e comparable",+ "type": [+ "-\u003e",+ [+ "_List",+ "comparable"+ ],+ "comparable"+ ]+ },+ {+ "name": "minimum",+ "comment": "Find the minimum element in a non-empty list: `minimum [3,2,1] == 1`",+ "raw": "minimum : [comparable] -\u003e comparable",+ "type": [+ "-\u003e",+ [+ "_List",+ "comparable"+ ],+ "comparable"+ ]+ },+ {+ "name": "or",+ "comment": "Check to see if any elements are True.",+ "raw": "or : [Bool] -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Bool"+ ]+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "partition",+ "comment": "Split a list based on the predicate.",+ "raw": "partition : (a -\u003e Bool) -\u003e [a] -\u003e ([a],[a])",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_Tuple2",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ ]+ },+ {+ "name": "product",+ "comment": "Get the product of the list elements. `(product [1..4] == 24)`",+ "raw": "product : [number] -\u003e number",+ "type": [+ "-\u003e",+ [+ "_List",+ "number"+ ],+ "number"+ ]+ },+ {+ "name": "repeat",+ "comment": "Creates a list with *n* copies of a value:\n`(repeat 3 (0,0) == [(0,0),(0,0),(0,0)]`",+ "raw": "repeat : Int -\u003e a -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ "a",+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "reverse",+ "comment": "Reverse a list. `(reverse [1..4] == [4,3,2,1])`",+ "raw": "reverse : [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ },+ {+ "name": "scanl",+ "comment": "Reduce a list from the left, building up all of the intermediate results into a list.\n\n scanl (+) 0 [1,2,3,4] == [0,1,3,6,10]",+ "raw": "scanl : (a -\u003e b -\u003e b) -\u003e b -\u003e [a] -\u003e [b]",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "b"+ ]+ ]+ ]+ ]+ },+ {+ "name": "scanl1",+ "comment": "Same as scanl but it doesn't require a base case. List must be non-empty.\n\n scanl1 (+) [1,2,3,4] == [1,3,6,10]",+ "raw": "scanl1 : (a -\u003e a -\u003e a) -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "a",+ "a"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "sum",+ "comment": "Get the sum of the list elements. `(sum [1..4] == 10)`",+ "raw": "sum : [number] -\u003e number",+ "type": [+ "-\u003e",+ [+ "_List",+ "number"+ ],+ "number"+ ]+ },+ {+ "name": "tail",+ "comment": "Extract the elements after the head of the list. List must be non-empty.\n`(tail [1,2,3] == [2,3])`",+ "raw": "tail : [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ },+ {+ "name": "take",+ "comment": "Take the first n members of a list: `(take 2 [1,2,3,4] == [1,2])`",+ "raw": "take : Int -\u003e [a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "unzip",+ "comment": "Decompose a list of tuples.",+ "raw": "unzip : [(a,b)] -\u003e ([a],[b])",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ "a",+ "b"+ ]+ ],+ [+ "_Tuple2",+ [+ "_List",+ "a"+ ],+ [+ "_List",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "zip",+ "comment": "Combine two lists, combining them into tuples pairwise.\nIf one list is longer, the extra elements are dropped.\n\n zip [1,2,3] [6,7] == [(1,6),(2,7)]\n zip == zipWith (,)",+ "raw": "zip : [a] -\u003e [b] -\u003e [(a,b)]",+ "type": [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "-\u003e",+ [+ "_List",+ "b"+ ],+ [+ "_List",+ [+ "_Tuple2",+ "a",+ "b"+ ]+ ]+ ]+ ]+ },+ {+ "name": "zipWith",+ "comment": "Combine two lists, combining them with the given function.\nIf one list is longer, the extra elements are dropped.\n\n zipWith (+) [1,2,3] [1,2,3,4] == [2,4,6]",+ "raw": "zipWith : (a -\u003e b -\u003e c) -\u003e [a] -\u003e [b] -\u003e [c]",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "c"+ ]+ ],+ [+ "-\u003e",+ [+ "_List",+ "a"+ ],+ [+ "-\u003e",+ [+ "_List",+ "b"+ ],+ [+ "_List",+ "c"+ ]+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Maybe",+ "document": "Represents an optional value. Maybe it is there, maybe it is not.\n\n# Type and Constructors\n@docs Maybe\n\n# Taking Maybes apart\n@docs maybe, isJust, isNothing\n\n# Maybes and Lists\n@docs justs",+ "aliases": [],+ "datatypes": [+ {+ "name": "Maybe",+ "comment": "The Maybe datatype. Useful when a computation may or may not\nresult in a value (e.g. logarithm is defined only for positive\nnumbers).",+ "raw": "data Maybe a = Just a | Nothing",+ "typeVariables": [+ "a"+ ],+ "constructors": [+ {+ "name": "Just",+ "type": [+ "-\u003e",+ "a",+ [+ "Maybe",+ "a"+ ]+ ]+ },+ {+ "name": "Nothing",+ "type": [+ "Maybe",+ "a"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "isJust",+ "comment": "Check if constructed with `Just`.",+ "raw": "isJust : Maybe a -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Maybe",+ "a"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isNothing",+ "comment": "Check if constructed with `Nothing`.",+ "raw": "isNothing : Maybe a -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "Maybe",+ "a"+ ],+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "justs",+ "comment": "Filters out Nothings and extracts the remaining values.",+ "raw": "justs : [Maybe a] -\u003e [a]",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Maybe",+ "a"+ ]+ ],+ [+ "_List",+ "a"+ ]+ ]+ },+ {+ "name": "maybe",+ "comment": "Apply a function to the contents of a `Maybe`.\nReturn default when given `Nothing`.",+ "raw": "maybe : b -\u003e (a -\u003e b) -\u003e Maybe a -\u003e b",+ "type": [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "Maybe",+ "a"+ ],+ "b"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Mouse",+ "document": "Library for working with mouse input.\n\n# Position\n@docs position, x, y\n\n# Button Status\n@docs isDown, clicks, isClicked",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "clicks",+ "comment": "Always equal to unit. Event triggers on every mouse click.",+ "raw": "clicks : Signal ()",+ "type": [+ "Signal",+ [+ "_Tuple0"+ ]+ ]+ },+ {+ "name": "isClicked",+ "comment": "True immediately after the left mouse-button has been clicked,\nand false otherwise.",+ "raw": "isClicked : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "isDown",+ "comment": "The current state of the left mouse-button.\nTrue when the button is down, and false otherwise.",+ "raw": "isDown : Signal Bool",+ "type": [+ "Signal",+ [+ "Bool"+ ]+ ]+ },+ {+ "name": "position",+ "comment": "The current mouse position.",+ "raw": "position : Signal (Int,Int)",+ "type": [+ "Signal",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "x",+ "comment": "The current x-coordinate of the mouse.",+ "raw": "x : Signal Int",+ "type": [+ "Signal",+ [+ "Int"+ ]+ ]+ },+ {+ "name": "y",+ "comment": "The current y-coordinate of the mouse.",+ "raw": "y : Signal Int",+ "type": [+ "Signal",+ [+ "Int"+ ]+ ]+ }+ ]+},+{+ "name": "Prelude",+ "document": "Everything that is automatically imported",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "readFloat",+ "comment": "",+ "raw": "readFloat : String -\u003e Maybe Float",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "readInt",+ "comment": "",+ "raw": "readInt : String -\u003e Maybe Int",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "show",+ "comment": "",+ "raw": "show : a -\u003e String",+ "type": [+ "-\u003e",+ "a",+ [+ "String"+ ]+ ]+ }+ ]+},+{+ "name": "Random",+ "document": "Since the core of Elm is pure, randomness must be handled via signals.\n\n# Random Numbers\n@docs range, float, floatList",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "float",+ "comment": "Produces a new signal that changes whenever the input signal changes.\nThe new values are random numbers in [0..1).",+ "raw": "float : Signal a -\u003e Signal Float",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "floatList",+ "comment": "Produces a new signal of lists that changes whenever the input signal\nchanges. The input signal specifies the length of the random list. Each value is\na random number in [0..1).",+ "raw": "floatList : Signal Int -\u003e Signal [Float]",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "Int"+ ]+ ],+ [+ "Signal",+ [+ "_List",+ [+ "Float"+ ]+ ]+ ]+ ]+ },+ {+ "name": "range",+ "comment": "Given a range from low to high and a signal of values, this produces\na new signal that changes whenever the input signal changes. The new\nvalues are random number between 'low' and 'high' inclusive.",+ "raw": "range : Int -\u003e Int -\u003e Signal a -\u003e Signal Int",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "Int"+ ]+ ]+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Set",+ "document": "A set of unique values. The values can be any comparable type. This\nincludes `Int`, `Float`, `Time`, `Char`, `String`, and tuples or lists\nof comparable types.\n\nInsert, remove, and query operations all take *O(log n)* time.\n\n# Build\n@docs empty, singleton, insert, remove\n\n# Query\n@docs member\n\n# Combine\n@docs union, intersect, diff\n\n# Lists\n@docs toList, fromList\n\n# Transform\n@docs map, foldl, foldr",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "diff",+ "comment": "Get the difference between the first set and the second. Keeps values\nthat do not appear in the second set.",+ "raw": "diff : Set comparable -\u003e Set comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ ]+ },+ {+ "name": "empty",+ "comment": "Create an empty set.",+ "raw": "empty : Set comparable",+ "type": [+ "Set",+ "comparable"+ ]+ },+ {+ "name": "foldl",+ "comment": "Fold over the values in a set, in order from lowest to highest.",+ "raw": "foldl : (comparable -\u003e b -\u003e b) -\u003e b -\u003e Set comparable -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "foldr",+ "comment": "Fold over the values in a set, in order from highest to lowest.",+ "raw": "foldr : (comparable -\u003e b -\u003e b) -\u003e b -\u003e Set comparable -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "fromList",+ "comment": "Convert a list into a set, removing any duplicates.",+ "raw": "fromList : [comparable] -\u003e Set comparable",+ "type": [+ "-\u003e",+ [+ "_List",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ },+ {+ "name": "insert",+ "comment": "Insert a value into a set.",+ "raw": "insert : comparable -\u003e Set comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ ]+ },+ {+ "name": "intersect",+ "comment": "Get the intersection of two sets. Keeps values that appear in both sets.",+ "raw": "intersect : Set comparable -\u003e Set comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ ]+ },+ {+ "name": "map",+ "comment": "Map a function onto a set, creating a new set with no duplicates.",+ "raw": "map : (comparable -\u003e comparable') -\u003e Set comparable -\u003e Set comparable'",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "comparable",+ "comparable'"+ ],+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable'"+ ]+ ]+ ]+ },+ {+ "name": "member",+ "comment": "Determine if a value is in a set.",+ "raw": "member : comparable -\u003e Set comparable -\u003e Bool",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "remove",+ "comment": "Remove a value from a set. If the value is not found, no changes are made.",+ "raw": "remove : comparable -\u003e Set comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ "comparable",+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ ]+ },+ {+ "name": "singleton",+ "comment": "Create a set with one value.",+ "raw": "singleton : comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ "comparable",+ [+ "Set",+ "comparable"+ ]+ ]+ },+ {+ "name": "toList",+ "comment": "Convert a set into a list.",+ "raw": "toList : Set comparable -\u003e [comparable]",+ "type": [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "_List",+ "comparable"+ ]+ ]+ },+ {+ "name": "union",+ "comment": "Get the union of two sets. Keep all values.",+ "raw": "union : Set comparable -\u003e Set comparable -\u003e Set comparable",+ "type": [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "-\u003e",+ [+ "Set",+ "comparable"+ ],+ [+ "Set",+ "comparable"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Signal",+ "document": "The library for general signal manipulation. Includes lift functions up to\n`lift8` and infix lift operators `\u003c~` and `~`, combinations, filters, and\npast-dependence.\n\nSignals are time-varying values. Lifted functions are reevaluated whenver any of\ntheir input signals has an event. Signal events may be of the same value as the\nprevious value of the signal. Such signals are useful for timing and\npast-dependence.\n\nSome useful functions for working with time (e.g. setting FPS) and combining\nsignals and time (e.g. delaying updates, getting timestamps) can be found in\nthe [`Time`](/docs/Signal/Time.elm) library.\n\n# Combine\n@docs constant, lift, lift2, merge, merges, combine\n\n# Past-Dependence\n@docs foldp, count, countIf\n\n#Filters\n@docs keepIf, dropIf, keepWhen, dropWhen, dropRepeats, sampleOn\n\n# Pretty Lift\n@docs (\u003c~), (~)\n\n# Do you even lift?\n@docs lift3, lift4, lift5, lift6, lift7, lift8",+ "aliases": [],+ "datatypes": [+ {+ "name": "Signal",+ "comment": "",+ "raw": "data Signal a = Signal",+ "typeVariables": [+ "a"+ ],+ "constructors": [+ {+ "name": "Signal",+ "type": [+ "Signal",+ "a"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "\u003c~",+ "comment": "An alias for `lift`. A prettier way to apply a function to the current value\nof a signal.",+ "raw": "(\u003c~) : (a -\u003e b) -\u003e Signal a -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 4+ },+ {+ "name": "combine",+ "comment": "Combine a list of signals into a signal of lists.",+ "raw": "combine : [Signal a] -\u003e Signal [a]",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Signal",+ "a"+ ]+ ],+ [+ "Signal",+ [+ "_List",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "constant",+ "comment": "Create a constant signal that never changes.",+ "raw": "constant : a -\u003e Signal a",+ "type": [+ "-\u003e",+ "a",+ [+ "Signal",+ "a"+ ]+ ]+ },+ {+ "name": "count",+ "comment": "Count the number of events that have occured.",+ "raw": "count : Signal a -\u003e Signal Int",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "countIf",+ "comment": "Count the number of events that have occured that satisfy a given predicate.",+ "raw": "countIf : (a -\u003e Bool) -\u003e Signal a -\u003e Signal Int",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "Int"+ ]+ ]+ ]+ ]+ },+ {+ "name": "dropIf",+ "comment": "Drop events that satisfy the given predicate. Elm does not allow undefined\nsignals, so a base case must be provided in case the predicate is never\nsatisfied.",+ "raw": "dropIf : (a -\u003e Bool) -\u003e a -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ ]+ },+ {+ "name": "dropRepeats",+ "comment": "Drop sequential repeated values. For example, if a signal produces the\nsequence `[1,1,2,2,1]`, it becomes `[1,2,1]` by dropping the values that are the\nsame as the previous value.",+ "raw": "dropRepeats : Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ },+ {+ "name": "dropWhen",+ "comment": "Drop events when the first signal is true. When the first signal becomes\nfalse, the most recent value of the second signal will be propagated. Until the\nfirst signal becomes true again, all events will be propagated. Elm does not\nallow undefined signals, so a base case must be provided in case the first\nsignal is always true.",+ "raw": "dropWhen : Signal Bool -\u003e a -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ ]+ },+ {+ "name": "foldp",+ "comment": "Create a past-dependent signal. Each value given on the input signal will\nbe accumulated, producing a new output value.\n\nFor instance, `foldp (+) 0 (fps 40)` is the time the program has been running,\nupdated 40 times a second.",+ "raw": "foldp : (a -\u003e b -\u003e b) -\u003e b -\u003e Signal a -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ]+ ]+ },+ {+ "name": "keepIf",+ "comment": "Keep only events that satisfy the given predicate. Elm does not allow\nundefined signals, so a base case must be provided in case the predicate is\nnever satisfied.",+ "raw": "keepIf : (a -\u003e Bool) -\u003e a -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ ]+ },+ {+ "name": "keepWhen",+ "comment": "Keep events only when the first signal is true. When the first signal\nbecomes true, the most recent value of the second signal will be propagated.\nUntil the first signal becomes false again, all events will be propagated. Elm\ndoes not allow undefined signals, so a base case must be provided in case the\nfirst signal is never true.",+ "raw": "keepWhen : Signal Bool -\u003e a -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift",+ "comment": "Transform a signal with a given function.",+ "raw": "lift : (a -\u003e b) -\u003e Signal a -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "lift2",+ "comment": "Combine two signals with a given function.",+ "raw": "lift2 : (a -\u003e b -\u003e c) -\u003e Signal a -\u003e Signal b -\u003e Signal c",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ "c"+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "Signal",+ "c"+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift3",+ "comment": "",+ "raw": "lift3 : (a -\u003e b -\u003e c -\u003e d) -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ "d"+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "Signal",+ "d"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift4",+ "comment": "",+ "raw": "lift4 : (a -\u003e b -\u003e c -\u003e d -\u003e e) -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d -\u003e Signal e",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ [+ "-\u003e",+ "d",+ "e"+ ]+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "d"+ ],+ [+ "Signal",+ "e"+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift5",+ "comment": "",+ "raw": "lift5 : (a -\u003e b -\u003e c -\u003e d -\u003e e -\u003e f) -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d -\u003e Signal e -\u003e Signal f",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ [+ "-\u003e",+ "d",+ [+ "-\u003e",+ "e",+ "f"+ ]+ ]+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "d"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "e"+ ],+ [+ "Signal",+ "f"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift6",+ "comment": "",+ "raw": "lift6 : (a -\u003e b -\u003e c -\u003e d -\u003e e -\u003e f -\u003e g)\n -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d -\u003e Signal e -\u003e Signal f -\u003e Signal g",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ [+ "-\u003e",+ "d",+ [+ "-\u003e",+ "e",+ [+ "-\u003e",+ "f",+ "g"+ ]+ ]+ ]+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "d"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "e"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "f"+ ],+ [+ "Signal",+ "g"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift7",+ "comment": "",+ "raw": "lift7 : (a -\u003e b -\u003e c -\u003e d -\u003e e -\u003e f -\u003e g -\u003e h)\n -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d -\u003e Signal e -\u003e Signal f -\u003e Signal g -\u003e Signal h",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ [+ "-\u003e",+ "d",+ [+ "-\u003e",+ "e",+ [+ "-\u003e",+ "f",+ [+ "-\u003e",+ "g",+ "h"+ ]+ ]+ ]+ ]+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "d"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "e"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "f"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "g"+ ],+ [+ "Signal",+ "h"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "lift8",+ "comment": "",+ "raw": "lift8 : (a -\u003e b -\u003e c -\u003e d -\u003e e -\u003e f -\u003e g -\u003e h -\u003e i)\n -\u003e Signal a -\u003e Signal b -\u003e Signal c -\u003e Signal d -\u003e Signal e -\u003e Signal f -\u003e Signal g -\u003e Signal h -\u003e Signal i",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ "a",+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ "c",+ [+ "-\u003e",+ "d",+ [+ "-\u003e",+ "e",+ [+ "-\u003e",+ "f",+ [+ "-\u003e",+ "g",+ [+ "-\u003e",+ "h",+ "i"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "c"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "d"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "e"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "f"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "g"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "h"+ ],+ [+ "Signal",+ "i"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "merge",+ "comment": "Merge two signals into one, biased towards the first signal if both signals\nupdate at the same time.",+ "raw": "merge : Signal a -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "merges",+ "comment": "Merge many signals into one, biased towards the left-most signal if multiple\nsignals update simultaneously.",+ "raw": "merges : [Signal a] -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Signal",+ "a"+ ]+ ],+ [+ "Signal",+ "a"+ ]+ ]+ },+ {+ "name": "sampleOn",+ "comment": "Sample from the second input every time an event occurs on the first input.\nFor example, `(sampleOn clicks (every second))` will give the approximate time\nof the latest click.",+ "raw": "sampleOn : Signal a -\u003e Signal b -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "b"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ]+ },+ {+ "name": "~",+ "comment": "Informally, an alias for `liftN`. Intersperse it between additional signal\narguments of the lifted function.\n\nFormally, signal application. This takes two signals, holding a function and\na value. It applies the current function to the current value.\n\nThe following expressions are equivalent:\n\n scene \u003c~ Window.dimensions ~ Mouse.position\n lift2 scene Window.dimensions Mouse.position",+ "raw": "(~) : Signal (a -\u003e b) -\u003e Signal a -\u003e Signal b",+ "type": [+ "-\u003e",+ [+ "Signal",+ [+ "-\u003e",+ "a",+ "b"+ ]+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "b"+ ]+ ]+ ],+ "associativity": "left",+ "precedence": 4+ }+ ]+},+{+ "name": "String",+ "document": "A built-in representation for efficient string manipulation. String literals\nare enclosed in `\"double quotes\"`. Strings are *not* lists of characters.\n\n# Basics\n@docs isEmpty, length, reverse, repeat\n\n# Building and Splitting\n@docs cons, uncons, append, concat, split, join, words, lines\n\n# Get Substrings\n@docs sub, left, right, dropLeft, dropRight\n\n# Check for Substrings\n@docs contains, startsWith, endsWith, indexes, indices\n\n# Conversions\n@docs toInt, toFloat, toList, fromList\n\n# Formatting\nCosmetic operations such as padding with extra characters or trimming whitespace.\n\n@docs toUpper, toLower,\n pad, padLeft, padRight,\n trim, trimLeft, trimRight\n\n# Higher-Order Functions\n@docs map, filter, foldl, foldr, any, all",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "all",+ "comment": "Check to see if *all* characters satisfy a predicate.\n\n all isDigit \"90210\" == True\n all isDigit \"R2-D2\" == False\n any isDigit \"heart\" == False",+ "raw": "all : (Char -\u003e Bool) -\u003e String -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "any",+ "comment": "Check to see if *any* characters satisfy a predicate.\n\n any isDigit \"90210\" == True\n any isDigit \"R2-D2\" == True\n any isDigit \"heart\" == False",+ "raw": "any : (Char -\u003e Bool) -\u003e String -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "append",+ "comment": "Append two strings. You can also use [the `(++)` operator](/library/List.elm#++)\nto do this.\n\n append \"butter\" \"fly\" == \"butterfly\"",+ "raw": "append : String -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "concat",+ "comment": "Concatenate many strings into one.\n\n concat [\"never\",\"the\",\"less\"] == \"nevertheless\"",+ "raw": "concat : [String] -\u003e String",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "String"+ ]+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "cons",+ "comment": "Add a character to the beginning of a string",+ "raw": "cons : Char -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "contains",+ "comment": "See if a string contains another one.\n\n contains \"the\" \"theory\" == True\n contains \"hat\" \"theory\" == False\n contains \"THE\" \"theory\" == False",+ "raw": "contains : String -\u003e String -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "dropLeft",+ "comment": "Drop N characters from the left side of a string.",+ "raw": "dropLeft : Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "dropRight",+ "comment": "Drop N characters from the right side of a string.",+ "raw": "dropRight : Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "endsWith",+ "comment": "See if a string ends with another one.\n\n endsWith \"the\" \"theory\" == False\n endsWith \"ory\" \"theory\" == True",+ "raw": "endsWith : String -\u003e String -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "filter",+ "comment": "Keep only the characters that satisfy the predicate:\n\n filter isDigit \"R2-D2\" == \"22\"",+ "raw": "filter : (Char -\u003e Bool) -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Bool"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "foldl",+ "comment": "Reduce a string from the left:\n\n foldl cons \"\" \"time\" == \"emit\"",+ "raw": "foldl : (Char -\u003e b -\u003e b) -\u003e b -\u003e String -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "String"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "foldr",+ "comment": "Reduce a string from the right:\n\n foldr cons \"\" \"time\" == \"time\"",+ "raw": "foldr : (Char -\u003e b -\u003e b) -\u003e b -\u003e String -\u003e b",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ "b",+ "b"+ ]+ ],+ [+ "-\u003e",+ "b",+ [+ "-\u003e",+ [+ "String"+ ],+ "b"+ ]+ ]+ ]+ },+ {+ "name": "fromList",+ "comment": "Convert a list of characters into a String. Can be useful if you\nwant to create a string primarly by consing, perhaps for decoding\nsomething.\n\n fromList ['a','b','c'] == \"abc\"",+ "raw": "fromList : String -\u003e [Char]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "Char"+ ]+ ]+ ]+ },+ {+ "name": "indexes",+ "comment": "Get all of the indexes for a substring.\n\n indexes \"i\" \"Mississippi\" == [1,4,7,10]\n indexes \"ss\" \"Mississippi\" == [2,5]\n indexes \"needle\" \"haystack\" == []",+ "raw": "indexes : String -\u003e String -\u003e [Int]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "Int"+ ]+ ]+ ]+ ]+ },+ {+ "name": "indices",+ "comment": "Alias for `indexes`",+ "raw": "indices : String -\u003e String -\u003e [Int]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "Int"+ ]+ ]+ ]+ ]+ },+ {+ "name": "isEmpty",+ "comment": "Check if a string is empty `(isEmpty \"\" == True)`",+ "raw": "isEmpty : String",+ "type": [+ "String"+ ]+ },+ {+ "name": "join",+ "comment": "Put many strings together with a given separator.\n\n join \" \" [\"cat\",\"dog\",\"cow\"] == \"cat dog cow\"\n join \"/\" [\"home\",\"evan\",\"Desktop\"] == \"home/evan/Desktop\"",+ "raw": "join : String -\u003e [String] -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "String"+ ]+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "left",+ "comment": "Take N characters from the left side of a string.",+ "raw": "left : Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "length",+ "comment": "Get the length of a string `(length \"innumerable\" == 11)`",+ "raw": "length : String -\u003e Int",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "lines",+ "comment": "Break a string into lines, splitting on newlines.\n\n lines \"How are you?\\nGood? == [\"How are you?\", \"Good?\"]",+ "raw": "lines : String -\u003e [String]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "map",+ "comment": "Transform every character in a string\n\n map (\\c -\u003e if c == '/' then '.' else c) \"a/b/c\" == \"a.b.c\"",+ "raw": "map : (Char -\u003e Char) -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "Char"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "pad",+ "comment": "Pad a string on both sides until it has a given length.\n\n pad 5 ' ' \"1\" == \" 1 \"\n pad 5 ' ' \"11\" == \" 11 \"\n pad 5 ' ' \"121\" == \" 121 \"",+ "raw": "pad : Int -\u003e Char -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "padLeft",+ "comment": "Pad a string on the left until it has a given length.\n\n pad 5 '.' \"1\" == \"....1\"\n pad 5 '.' \"11\" == \"...11\"\n pad 5 '.' \"121\" == \"..121\"",+ "raw": "padLeft : Int -\u003e Char -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "padRight",+ "comment": "Pad a string on the right until it has a given length.\n\n pad 5 '.' \"1\" == \"1....\"\n pad 5 '.' \"11\" == \"11...\"\n pad 5 '.' \"121\" == \"121..\"",+ "raw": "padRight : Int -\u003e Char -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Char"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "repeat",+ "comment": "Repeat a string N times `(repeat 3 \"ha\" == \"hahaha\")`",+ "raw": "repeat : Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "reverse",+ "comment": "Reverse a string. `(reverse \"stressed\" == \"desserts\")`",+ "raw": "reverse : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "right",+ "comment": "Take N characters from the right side of a string.",+ "raw": "right : Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ },+ {+ "name": "split",+ "comment": "Split a string using a given separator.\n\n split \",\" \"cat,dog,cow\" == [\"cat\",\"dog\",\"cow\"]\n split \"/\" \"home/evan/Desktop/\" == [\"home\",\"evan\",\"Desktop\"]",+ "raw": "split : String -\u003e String -\u003e [String]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "startsWith",+ "comment": "See if a string starts with another one.\n\n startsWith \"the\" \"theory\" == True\n startsWith \"ory\" \"theory\" == False",+ "raw": "startsWith : String -\u003e String -\u003e Bool",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Bool"+ ]+ ]+ ]+ },+ {+ "name": "sub",+ "comment": "Take a substring given a start and end index. Negative indexes\nare taken starting from the *end* of the list.\n\n sub 7 9 \"snakes on a plane!\" == \"on\"\n sub 0 6 \"snakes on a plane!\" == \"snakes\"\n sub 0 -7 \"snakes on a plane!\" == \"snakes on a\"\n sub -6 -1 \"snakes on a plane!\" == \"plane\"",+ "raw": "sub : Int -\u003e Int -\u003e String -\u003e String",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "toFloat",+ "comment": "Try to convert a string into a float, failing on improperly formatted strings.\n\n toFloat \"123\" == Just 123.0\n toFloat \"-42\" == Just -42.0\n toFloat \"3.1\" == Just 3.1\n toFloat \"31a\" == Nothing",+ "raw": "toFloat : String -\u003e Maybe Float",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "toInt",+ "comment": "Try to convert a string into an int, failing on improperly formatted strings.\n\n toInt \"123\" == Just 123\n toInt \"-42\" == Just -42\n toInt \"3.1\" == Nothing\n toInt \"31a\" == Nothing",+ "raw": "toInt : String -\u003e Maybe Int",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "toList",+ "comment": "Convert a string to a list of characters.\n\n toList \"abc\" == ['a','b','c']",+ "raw": "toList : String -\u003e [Char]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "Char"+ ]+ ]+ ]+ },+ {+ "name": "toLower",+ "comment": "Convert a string to all lower case. Useful for case insensitive comparisons.",+ "raw": "toLower : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "toUpper",+ "comment": "Convert a string to all upper case. Useful for case insensitive comparisons\nand VIRTUAL YELLING.",+ "raw": "toUpper : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "trim",+ "comment": "Get rid of whitespace on both sides of a string.\n\n trim \" hats \\n\" == \"hats\"",+ "raw": "trim : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "trimLeft",+ "comment": "Get rid of whitespace on the left of a string.\n\n trimLeft \" hats \\n\" == \"hats \\n\"",+ "raw": "trimLeft : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "trimRight",+ "comment": "Get rid of whitespace on the left of a string.\n\n trimRight \" hats \\n\" == \" hats\"",+ "raw": "trimRight : String -\u003e String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "String"+ ]+ ]+ },+ {+ "name": "uncons",+ "comment": "Split a non-empty string into its head and tail. This lets you\npattern match on strings exactly as you would with lists.\n\n uncons \"abc\" == Just ('a',\"bc\")\n uncons \"\" == Nothing",+ "raw": "uncons : String -\u003e Maybe (Char, String)",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Maybe",+ [+ "_Tuple2",+ [+ "Char"+ ],+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "words",+ "comment": "Break a string into words, splitting on chunks of whitespace.\n\n words \"How are \\t you? \\n Good?\" == [\"How\",\"are\",\"you?\",\"Good?\"]",+ "raw": "words : String -\u003e [String]",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_List",+ [+ "String"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Text",+ "document": "Functions for displaying text\n\n# Creating Text\n@docs toText\n\n# Creating Elements\n@docs plainText, asText, text, centered, justified, righted\n\n# Formatting\n@docs color, typeface, height, link\n\n# Simple Formatting\n@docs monospace, header, bold, italic, underline, overline, strikeThrough",+ "aliases": [],+ "datatypes": [+ {+ "name": "Text",+ "comment": "",+ "raw": "data Text = Text",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Text",+ "type": [+ "Text"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "asText",+ "comment": "Convert anything to it's textual representation and make it displayable in\nbrowser\n\n asText == text . monospace . show\n\nExcellent for debugging.",+ "raw": "asText : a -\u003e Element",+ "type": [+ "-\u003e",+ "a",+ [+ "Element"+ ]+ ]+ },+ {+ "name": "bold",+ "comment": "Make a string bold.",+ "raw": "bold : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "centered",+ "comment": "Display centered, styled text.",+ "raw": "centered : Text -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "color",+ "comment": "Set the color of a string.",+ "raw": "color : Color -\u003e Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ ]+ },+ {+ "name": "header",+ "comment": "Make text big and noticable.",+ "raw": "header : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "height",+ "comment": "Set the height of text in pixels.",+ "raw": "height : Float -\u003e Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ ]+ },+ {+ "name": "italic",+ "comment": "Italicize a string.",+ "raw": "italic : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "justified",+ "comment": "Display justified, styled text.",+ "raw": "justified : Text -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "link",+ "comment": "Create a link.",+ "raw": "link : String -\u003e Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ ]+ },+ {+ "name": "markdown",+ "comment": "for internal use only",+ "raw": "markdown : Element",+ "type": [+ "Element"+ ]+ },+ {+ "name": "monospace",+ "comment": "Switch to a monospace typeface. Good for code snippets.",+ "raw": "monospace : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "overline",+ "comment": "Draw a line above a string.",+ "raw": "overline : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "plainText",+ "comment": "Display a plain string.",+ "raw": "plainText : String -\u003e Element",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "righted",+ "comment": "Display right justified, styled text.",+ "raw": "righted : Text -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "strikeThrough",+ "comment": "Draw a line through a string.",+ "raw": "strikeThrough : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "text",+ "comment": "Display styled text.",+ "raw": "text : Text -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "toText",+ "comment": "Convert a string into text which can be styled and displayed.",+ "raw": "toText : String -\u003e Text",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "Text"+ ]+ ]+ },+ {+ "name": "typeface",+ "comment": "Set the typeface of some text. The first argument should be a comma\nseparated listing of the desired typefaces\n\n \"helvetica, arial, sans-serif\"\n\nWorks the same as the CSS font-family property.",+ "raw": "typeface : String -\u003e Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ ]+ },+ {+ "name": "underline",+ "comment": "Underline a string.",+ "raw": "underline : Text -\u003e Text",+ "type": [+ "-\u003e",+ [+ "Text"+ ],+ [+ "Text"+ ]+ ]+ }+ ]+},+{+ "name": "Time",+ "document": "Library for working with time.\n\n# Units\n@docs Time, millisecond, second, minute, hour,\n inMilliseconds, inSeconds, inMinutes, inHours\n\n# Tickers\n@docs fps, fpsWhen, every\n\n# Timing\n@docs timestamp, delay, since",+ "aliases": [+ {+ "name": "Time",+ "comment": "Type alias to make it clearer when you are working with time values.\nUsing the `Time` constants instead of raw numbers is very highly recommended.",+ "raw": "type Time = Float",+ "typeVariables": [],+ "type": [+ "Float"+ ]+ }+ ],+ "datatypes": [],+ "values": [+ {+ "name": "delay",+ "comment": "Delay a signal by a certain amount of time. So `(delay second Mouse.clicks)`\nwill update one second later than any mouse click.",+ "raw": "delay : Time -\u003e Signal a -\u003e Signal a",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "every",+ "comment": "Takes a time interval t. The resulting signal is the current time, updated\nevery t.",+ "raw": "every : Time -\u003e Signal Time",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "Signal",+ [+ "Time"+ ]+ ]+ ]+ },+ {+ "name": "fps",+ "comment": "Takes desired number of frames per second (fps). The resulting signal\ngives a sequence of time deltas as quickly as possible until it reaches\nthe desired FPS. A time delta is the time between the last frame and the\ncurrent frame.",+ "raw": "fps : number -\u003e Signal Time",+ "type": [+ "-\u003e",+ "number",+ [+ "Signal",+ [+ "Time"+ ]+ ]+ ]+ },+ {+ "name": "fpsWhen",+ "comment": "Same as the fps function, but you can turn it on and off. Allows you\nto do brief animations based on user input without major inefficiencies.\nThe first time delta after a pause is always zero, no matter how long\nthe pause was. This way summing the deltas will actually give the amount\nof time that the output signal has been running.",+ "raw": "fpsWhen : number -\u003e Signal Bool -\u003e Signal Time",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "Signal",+ [+ "Bool"+ ]+ ],+ [+ "Signal",+ [+ "Time"+ ]+ ]+ ]+ ]+ },+ {+ "name": "hour",+ "comment": "",+ "raw": "hour : Time",+ "type": [+ "Time"+ ]+ },+ {+ "name": "inHours",+ "comment": "",+ "raw": "inHours : Time -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "inMilliseconds",+ "comment": "",+ "raw": "inMilliseconds : Time -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "inMinutes",+ "comment": "",+ "raw": "inMinutes : Time -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "inSeconds",+ "comment": "",+ "raw": "inSeconds : Time -\u003e Float",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "Float"+ ]+ ]+ },+ {+ "name": "millisecond",+ "comment": "Units of time, making it easier to specify things like a half-second\n`(500 * milliseconds)` without remembering Elm’s underlying units of time.",+ "raw": "millisecond : Time",+ "type": [+ "Time"+ ]+ },+ {+ "name": "minute",+ "comment": "",+ "raw": "minute : Time",+ "type": [+ "Time"+ ]+ },+ {+ "name": "second",+ "comment": "",+ "raw": "second : Time",+ "type": [+ "Time"+ ]+ },+ {+ "name": "since",+ "comment": "Takes a time `t` and any signal. The resulting boolean signal is true for\ntime `t` after every event on the input signal. So ``(second `since`\nMouse.clicks)`` would result in a signal that is true for one second after\neach mouse click and false otherwise.",+ "raw": "since : Time -\u003e Signal a -\u003e Signal Bool",+ "type": [+ "-\u003e",+ [+ "Time"+ ],+ [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "Bool"+ ]+ ]+ ]+ ]+ },+ {+ "name": "timestamp",+ "comment": "Add a timestamp to any signal. Timestamps increase monotonically. Each\ntimestamp is related to a specfic event, so `Mouse.x` and `Mouse.y` will always\nhave the same timestamp because they both rely on the same underlying event.",+ "raw": "timestamp : Signal a -\u003e Signal (Time, a)",+ "type": [+ "-\u003e",+ [+ "Signal",+ "a"+ ],+ [+ "Signal",+ [+ "_Tuple2",+ [+ "Time"+ ],+ "a"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Touch",+ "document": "This is an early version of the touch library. It will likely grow to\ninclude gestures that would be useful for both games and web-pages.\n\n# Touches\n@docs Touch, touches\n\n# Gestures\n@docs taps",+ "aliases": [+ {+ "name": "Touch",+ "comment": "Every `Touch` has `xy` coordinates. It also has an identifier\n`id` to distinguish one touch from another.\n\nA touch also keeps info about the initial point and time of contact:\n`x0`, `y0`, and `t0`. This helps compute more complicated gestures\nlike taps, drags, and swipes which need to know about timing or direction.",+ "raw": "type Touch = { x:Int, y:Int, id:Int, x0:Int, y0:Int, t0:Time }",+ "typeVariables": [],+ "type": {+ "y0": [+ "Int"+ ],+ "y": [+ "Int"+ ],+ "x": [+ "Int"+ ],+ "id": [+ "Int"+ ],+ "t0": [+ "Time"+ ],+ "x0": [+ "Int"+ ]+ }+ }+ ],+ "datatypes": [],+ "values": [+ {+ "name": "taps",+ "comment": "The last position that was tapped. Default value is `{x=0,y=0}`.\nUpdates whenever the user taps the screen.",+ "raw": "taps : Signal { x:Int, y:Int }",+ "type": [+ "Signal",+ {+ "y": [+ "Int"+ ],+ "x": [+ "Int"+ ]+ }+ ]+ },+ {+ "name": "touches",+ "comment": "A list of ongoing touches.",+ "raw": "touches : Signal [Touch]",+ "type": [+ "Signal",+ [+ "_List",+ [+ "Touch"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Transform2D",+ "document": "A library for performing [2D matrix transformations](http://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations).\nIt is used primarily with the `groupTransform` function from `Graphics.Collage` and\nallows you to do things like rotation, scaling, translation, shearing, and reflection.\n\n# Basic Transforms\n@docs identity, matrix, rotation\n\n# Multiplication\n@docs multiply",+ "aliases": [],+ "datatypes": [+ {+ "name": "Transform2D",+ "comment": "",+ "raw": "data Transform2D = Transform2D",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Transform2D",+ "type": [+ "Transform2D"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "identity",+ "comment": "Create an identity transform. Transforming by the identity does\nnot change anything, but it can come in handy as a default or\nbase case.\n\n / 1 0 \\\n \\ 0 1 /",+ "raw": "identity : Transform2D",+ "type": [+ "Transform2D"+ ]+ },+ {+ "name": "matrix",+ "comment": "Creates a transformation matrix. This lets you create transforms\nsuch as scales, shears, reflections, and translations.\n\n matrix a b c d dx dy\n\n / a b \\\n \\ c d /\n\nAnd `dx` and `dy` are the translation values.",+ "raw": "matrix : Float -\u003e Float -\u003e Float -\u003e Float -\u003e Float -\u003e Float -\u003e Transform2D",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Transform2D"+ ]+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "multiply",+ "comment": "Multiplies two transforms together:\n\n multiply a b\n\n / a11 a12 \\ . / b11 b12 \\\n \\ a21 a22 / \\ b21 b22 /",+ "raw": "multiply : Transform2D -\u003e Transform2D -\u003e Transform2D",+ "type": [+ "-\u003e",+ [+ "Transform2D"+ ],+ [+ "-\u003e",+ [+ "Transform2D"+ ],+ [+ "Transform2D"+ ]+ ]+ ]+ },+ {+ "name": "rotation",+ "comment": "Creates a [rotation matrix](http://en.wikipedia.org/wiki/Rotation_matrix).\nGiven an angle t, it creates a counterclockwise rotation matrix:\n\n / cos t -sin t \\\n \\ sin t cos t /",+ "raw": "rotation : Float -\u003e Transform2D",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Transform2D"+ ]+ ]+ }+ ]+},+{+ "name": "WebSocket",+ "document": "A library for low latency HTTP communication. See the HTTP library for\nstandard requests like GET, POST, etc. The API of this library is likely to\nchange to make it more flexible.\n\n# Open a Connection\n@docs connect",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "connect",+ "comment": "Create a web-socket. The first argument is the URL of the desired\nweb-socket server. The input signal holds the outgoing messages,\nand the resulting signal contains the incoming ones.",+ "raw": "connect : String -\u003e Signal String -\u003e Signal String",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Signal",+ [+ "String"+ ]+ ],+ [+ "Signal",+ [+ "String"+ ]+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Window",+ "document": "Provides information about the container that your Elm program lives in.\nWhen you embed Elm in a `\u003cdiv\u003e` it gives the dimensions of the container, not\nthe whole window.\n\n# Dimensions\n@docs dimensions, width, height",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "dimensions",+ "comment": "The current width and height of the window (i.e. the area viewable to the\nuser, not including scroll bars).",+ "raw": "dimensions : Signal (Int,Int)",+ "type": [+ "Signal",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "height",+ "comment": "The current height of the window.",+ "raw": "height : Signal Int",+ "type": [+ "Signal",+ [+ "Int"+ ]+ ]+ },+ {+ "name": "width",+ "comment": "The current width of the window.",+ "raw": "width : Signal Int",+ "type": [+ "Signal",+ [+ "Int"+ ]+ ]+ }+ ]+},+{+ "name": "Graphics.Collage",+ "document": "The collage API is for freeform graphics. You can move, rotate, scale, etc.\nall sorts of forms including lines, shapes, images, and elements.\n\n# Unstructured Graphics\n@docs collage\n \n# Creating Forms\n@docs toForm, filled, textured, gradient, outlined, traced\n \n# Transforming Forms\n@docs move, moveX, moveY, scale, rotate, alpha\n \n# Grouping Forms\nGrouping forms makes it easier to write modular graphics code. You can create\na form that is a composite of many subforms. From there it is easy to transform\nit as a single unit.\n\n@docs group, groupTransform\n \n# Shapes\n@docs rect, oval, square, circle, ngon, polygon\n\n# Paths\n@docs segment, path\n \n# Line Styles\n@docs solid, dashed, dotted, LineStyle, LineCap, LineJoin, defaultLine",+ "aliases": [+ {+ "name": "Form",+ "comment": "",+ "raw": "type Form = {\n theta : Float,\n scale : Float,\n x : Float,\n y : Float,\n alpha : Float,\n form : BasicForm\n }",+ "typeVariables": [],+ "type": {+ "alpha": [+ "Float"+ ],+ "y": [+ "Float"+ ],+ "form": [+ "BasicForm"+ ],+ "x": [+ "Float"+ ],+ "theta": [+ "Float"+ ],+ "scale": [+ "Float"+ ]+ }+ },+ {+ "name": "LineStyle",+ "comment": "All of the attributes of a line style. This lets you build up a line style\nhowever you want. You can also update existing line styles with record updates.",+ "raw": "type LineStyle = {\n color : Color,\n width : Float,\n cap : LineCap,\n join : LineJoin,\n dashing : [Int],\n dashOffset : Int\n }",+ "typeVariables": [],+ "type": {+ "width": [+ "Float"+ ],+ "dashOffset": [+ "Int"+ ],+ "color": [+ "Color"+ ],+ "join": [+ "LineJoin"+ ],+ "dashing": [+ "_List",+ [+ "Int"+ ]+ ],+ "cap": [+ "LineCap"+ ]+ }+ },+ {+ "name": "Path",+ "comment": "",+ "raw": "type Path = [(Float,Float)]",+ "typeVariables": [],+ "type": [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ },+ {+ "name": "Shape",+ "comment": "",+ "raw": "type Shape = [(Float,Float)]",+ "typeVariables": [],+ "type": [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ]+ }+ ],+ "datatypes": [+ {+ "name": "BasicForm",+ "comment": "",+ "raw": "data BasicForm\n = FPath LineStyle Path\n | FShape (Either LineStyle FillStyle) Shape\n | FImage Int Int (Int,Int) String\n | FElement Element\n | FGroup Transform2D [Form]",+ "typeVariables": [],+ "constructors": [+ {+ "name": "FPath",+ "type": [+ "-\u003e",+ [+ "LineStyle"+ ],+ [+ "-\u003e",+ [+ "Path"+ ],+ [+ "BasicForm"+ ]+ ]+ ]+ },+ {+ "name": "FShape",+ "type": [+ "-\u003e",+ [+ "Either",+ [+ "LineStyle"+ ],+ [+ "FillStyle"+ ]+ ],+ [+ "-\u003e",+ [+ "Shape"+ ],+ [+ "BasicForm"+ ]+ ]+ ]+ },+ {+ "name": "FImage",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "BasicForm"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "FElement",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "BasicForm"+ ]+ ]+ },+ {+ "name": "FGroup",+ "type": [+ "-\u003e",+ [+ "Transform2D"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "Form"+ ]+ ],+ [+ "BasicForm"+ ]+ ]+ ]+ }+ ]+ },+ {+ "name": "FillStyle",+ "comment": "",+ "raw": "data FillStyle\n = Solid Color\n | Texture String\n | Grad Gradient",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Solid",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "FillStyle"+ ]+ ]+ },+ {+ "name": "Texture",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "FillStyle"+ ]+ ]+ },+ {+ "name": "Grad",+ "type": [+ "-\u003e",+ [+ "Gradient"+ ],+ [+ "FillStyle"+ ]+ ]+ }+ ]+ },+ {+ "name": "LineCap",+ "comment": "The shape of the ends of a line.",+ "raw": "data LineCap = Flat | Round | Padded",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Flat",+ "type": [+ "LineCap"+ ]+ },+ {+ "name": "Round",+ "type": [+ "LineCap"+ ]+ },+ {+ "name": "Padded",+ "type": [+ "LineCap"+ ]+ }+ ]+ },+ {+ "name": "LineJoin",+ "comment": "The shape of the “joints” of a line, where each line segment\nmeets. `Sharp` takes an argument to limit the length of the joint. This\ndefaults to 10.",+ "raw": "data LineJoin = Smooth | Sharp Float | Clipped",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Smooth",+ "type": [+ "LineJoin"+ ]+ },+ {+ "name": "Sharp",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "LineJoin"+ ]+ ]+ },+ {+ "name": "Clipped",+ "type": [+ "LineJoin"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "alpha",+ "comment": "Set the alpha of a `Form`. The default is 1, and 0 is totally transparent.",+ "raw": "alpha : Float -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "circle",+ "comment": "A circle with a given radius.",+ "raw": "circle : Float -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Shape"+ ]+ ]+ },+ {+ "name": "collage",+ "comment": "A collage is a collection of 2D forms. There are no strict positioning\nrelationships between forms, so you are free to do all kinds of 2D graphics.",+ "raw": "collage : Int -\u003e Int -\u003e [Form] -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "Form"+ ]+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ },+ {+ "name": "dashed",+ "comment": "Create a dashed line style with a given color. Dashing equals `[8,4]`.",+ "raw": "dashed : Color -\u003e LineStyle",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "LineStyle"+ ]+ ]+ },+ {+ "name": "defaultLine",+ "comment": "The default line style, which is solid black with flat caps and sharp joints.\nYou can use record updates to build the line style you\nwant. For example, to make a thicker line, you could say:\n\n { defaultLine | width \u003c- 10 }",+ "raw": "defaultLine : LineStyle",+ "type": [+ "LineStyle"+ ]+ },+ {+ "name": "dotted",+ "comment": "Create a dotted line style with a given color. Dashing equals `[3,3]`.",+ "raw": "dotted : Color -\u003e LineStyle",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "LineStyle"+ ]+ ]+ },+ {+ "name": "filled",+ "comment": "Create a filled in shape.",+ "raw": "filled : Color -\u003e Shape -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "-\u003e",+ [+ "Shape"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "form",+ "comment": "",+ "raw": "form : BasicForm -\u003e Form",+ "type": [+ "-\u003e",+ [+ "BasicForm"+ ],+ [+ "Form"+ ]+ ]+ },+ {+ "name": "gradient",+ "comment": "Fill a shape with a [gradient](/library/Color.elm#linear).",+ "raw": "gradient : Gradient -\u003e Shape -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Gradient"+ ],+ [+ "-\u003e",+ [+ "Shape"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "group",+ "comment": "Flatten many forms into a single `Form`. This lets you move and rotate them\nas a single unit, making it possible to build small, modular components.",+ "raw": "group : [Form] -\u003e Form",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Form"+ ]+ ],+ [+ "Form"+ ]+ ]+ },+ {+ "name": "groupTransform",+ "comment": "Flatten many forms into a single `Form` and then apply a matrix\ntransformation.",+ "raw": "groupTransform : Transform2D -\u003e [Form] -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Transform2D"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "Form"+ ]+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "move",+ "comment": "Move a form by the given amount. This is a relative translation so\n`(move (10,10) form)` would move `form` ten pixels up and ten pixels to the\nright.",+ "raw": "move : (number,number) -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ "number",+ "number"+ ],+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "moveX",+ "comment": "Move a shape in the x direction. This is relative so `(moveX 10 form)` moves\n`form` 10 pixels to the right.",+ "raw": "moveX : number -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "moveY",+ "comment": "Move a shape in the y direction. This is relative so `(moveY 10 form)` moves\n`form` upwards by 10 pixels.",+ "raw": "moveY : number -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "ngon",+ "comment": "A regular polygon with N sides. The first argument specifies the number\nof sides and the second is the radius. So to create a pentagon with radius\n30 you would say:\n\n ngon 5 30",+ "raw": "ngon : Int -\u003e Float -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Shape"+ ]+ ]+ ]+ },+ {+ "name": "outlined",+ "comment": "Outline a shape with a given line style.",+ "raw": "outlined : LineStyle -\u003e Shape -\u003e Form",+ "type": [+ "-\u003e",+ [+ "LineStyle"+ ],+ [+ "-\u003e",+ [+ "Shape"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "oval",+ "comment": "An oval with a given width and height.",+ "raw": "oval : Float -\u003e Float -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Shape"+ ]+ ]+ ]+ },+ {+ "name": "path",+ "comment": "Create a path that follows a sequence of points.",+ "raw": "path : [(Float,Float)] -\u003e Path",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ],+ [+ "Path"+ ]+ ]+ },+ {+ "name": "polygon",+ "comment": "Create an arbitrary polygon by specifying its corners in order.\n`polygon` will automatically close all shapes, so the given list\nof points does not need to start and end with the same position.",+ "raw": "polygon : [(Float,Float)] -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ]+ ],+ [+ "Shape"+ ]+ ]+ },+ {+ "name": "rect",+ "comment": "A rectangle with a given width and height.",+ "raw": "rect : Float -\u003e Float -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Shape"+ ]+ ]+ ]+ },+ {+ "name": "rotate",+ "comment": "Rotate a form by a given angle. Rotate takes standard Elm angles (radians)\nand turns things counterclockwise. So to turn `form` 30° to the left\nyou would say, `(rotate (degrees 30) form)`.",+ "raw": "rotate : number -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "scale",+ "comment": "Scale a form by a given factor. Scaling by 2 doubles the size.",+ "raw": "scale : number -\u003e Form -\u003e Form",+ "type": [+ "-\u003e",+ "number",+ [+ "-\u003e",+ [+ "Form"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "segment",+ "comment": "Create a path along a given line segment.",+ "raw": "segment : (Float,Float) -\u003e (Float,Float) -\u003e Path",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Float"+ ],+ [+ "Float"+ ]+ ],+ [+ "Path"+ ]+ ]+ ]+ },+ {+ "name": "solid",+ "comment": "Create a solid line style with a given color.",+ "raw": "solid : Color -\u003e LineStyle",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "LineStyle"+ ]+ ]+ },+ {+ "name": "sprite",+ "comment": "Create a sprite from a sprite sheet. It cuts out a rectangle\nat a given position.",+ "raw": "sprite : Int -\u003e Int -\u003e (Int,Int) -\u003e String -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Form"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "square",+ "comment": "A square with a given edge length.",+ "raw": "square : Float -\u003e Shape",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Shape"+ ]+ ]+ },+ {+ "name": "textured",+ "comment": "Create a textured shape. The texture is described by some url and is\ntiled to fill the entire shape.",+ "raw": "textured : String -\u003e Shape -\u003e Form",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Shape"+ ],+ [+ "Form"+ ]+ ]+ ]+ },+ {+ "name": "toForm",+ "comment": "Turn any `Element` into a `Form`. This lets you use text, gifs, and video\nin your collage. This means you can move, rotate, and scale\nan `Element` however you want.",+ "raw": "toForm : Element -\u003e Form",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Form"+ ]+ ]+ },+ {+ "name": "traced",+ "comment": "Trace a path with a given line style.",+ "raw": "traced : LineStyle -\u003e Path -\u003e Form",+ "type": [+ "-\u003e",+ [+ "LineStyle"+ ],+ [+ "-\u003e",+ [+ "Path"+ ],+ [+ "Form"+ ]+ ]+ ]+ }+ ]+},+{+ "name": "Graphics.Element",+ "document": "Graphical elements that snap together to build complex widgets and layouts.\nEach Element is a rectangle with a known width and height, making them easy to\ncombine and position.\n\n# Images\n@docs image, fittedImage, croppedImage, tiledImage\n\n# Styling\n@docs width, height, size, color, opacity, link, tag\n\n# Inspection\n@docs widthOf, heightOf, sizeOf\n\n# Layout\n@docs flow, up, down, left, right, inward, outward\n\n## Layout Aliases\nThere are also some convenience functions for working\nwith `flow` in specific cases:\n\n@docs layers, above, below, beside\n\n# Positioning\n@docs spacer, container\n\n## Specific Positions\n\nTo create a `Position` you can use any of the built-in positions\nwhich cover nine common positions.\n@docs middle, midTop, midBottom, midLeft, midRight, topLeft, topRight,\n bottomLeft, bottomRight\n\nIf you need more precision, you can create custom positions.\n\n@docs absolute, relative, middleAt, midTopAt, midBottomAt, midLeftAt,\n midRightAt, topLeftAt, topRightAt, bottomLeftAt, bottomRightAt",+ "aliases": [+ {+ "name": "Element",+ "comment": "",+ "raw": "type Element = { props : Properties, element : ElementPrim }",+ "typeVariables": [],+ "type": {+ "props": [+ "Properties"+ ],+ "element": [+ "ElementPrim"+ ]+ }+ },+ {+ "name": "Position",+ "comment": "",+ "raw": "type Position = { horizontal : Three, vertical : Three, x : Pos, y : Pos }",+ "typeVariables": [],+ "type": {+ "y": [+ "Pos"+ ],+ "horizontal": [+ "Three"+ ],+ "x": [+ "Pos"+ ],+ "vertical": [+ "Three"+ ]+ }+ },+ {+ "name": "Properties",+ "comment": "",+ "raw": "type Properties = {\n id : Int,\n width : Int,\n height : Int,\n opacity : Float,\n color : Maybe Color,\n href : JSString,\n tag : JSString,\n hover : ()\n }",+ "typeVariables": [],+ "type": {+ "height": [+ "Int"+ ],+ "href": [+ "JSString"+ ],+ "width": [+ "Int"+ ],+ "id": [+ "Int"+ ],+ "color": [+ "Maybe",+ [+ "Color"+ ]+ ],+ "opacity": [+ "Float"+ ],+ "hover": [+ "_Tuple0"+ ],+ "tag": [+ "JSString"+ ]+ }+ }+ ],+ "datatypes": [+ {+ "name": "Direction",+ "comment": "",+ "raw": "data Direction = DUp | DDown | DLeft | DRight | DIn | DOut",+ "typeVariables": [],+ "constructors": [+ {+ "name": "DUp",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "DDown",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "DLeft",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "DRight",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "DIn",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "DOut",+ "type": [+ "Direction"+ ]+ }+ ]+ },+ {+ "name": "ElementPrim",+ "comment": "",+ "raw": "data ElementPrim\n = Image ImageStyle Int Int JSString\n | Container Position Element\n | Flow Direction [Element]\n | Spacer\n | RawHtml JSString\n | Custom",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Image",+ "type": [+ "-\u003e",+ [+ "ImageStyle"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "JSString"+ ],+ [+ "ElementPrim"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "Container",+ "type": [+ "-\u003e",+ [+ "Position"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "ElementPrim"+ ]+ ]+ ]+ },+ {+ "name": "Flow",+ "type": [+ "-\u003e",+ [+ "Direction"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "Element"+ ]+ ],+ [+ "ElementPrim"+ ]+ ]+ ]+ },+ {+ "name": "Spacer",+ "type": [+ "ElementPrim"+ ]+ },+ {+ "name": "RawHtml",+ "type": [+ "-\u003e",+ [+ "JSString"+ ],+ [+ "ElementPrim"+ ]+ ]+ },+ {+ "name": "Custom",+ "type": [+ "ElementPrim"+ ]+ }+ ]+ },+ {+ "name": "ImageStyle",+ "comment": "",+ "raw": "data ImageStyle = Plain | Fitted | Cropped (Int,Int) | Tiled",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Plain",+ "type": [+ "ImageStyle"+ ]+ },+ {+ "name": "Fitted",+ "type": [+ "ImageStyle"+ ]+ },+ {+ "name": "Cropped",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ],+ [+ "ImageStyle"+ ]+ ]+ },+ {+ "name": "Tiled",+ "type": [+ "ImageStyle"+ ]+ }+ ]+ },+ {+ "name": "Pos",+ "comment": "",+ "raw": "data Pos = Absolute Int | Relative Float",+ "typeVariables": [],+ "constructors": [+ {+ "name": "Absolute",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Pos"+ ]+ ]+ },+ {+ "name": "Relative",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Pos"+ ]+ ]+ }+ ]+ },+ {+ "name": "Three",+ "comment": "",+ "raw": "data Three = P | Z | N",+ "typeVariables": [],+ "constructors": [+ {+ "name": "P",+ "type": [+ "Three"+ ]+ },+ {+ "name": "Z",+ "type": [+ "Three"+ ]+ },+ {+ "name": "N",+ "type": [+ "Three"+ ]+ }+ ]+ }+ ],+ "values": [+ {+ "name": "above",+ "comment": "Stack elements vertically.\nTo put `a` above `b` you would say: ``a `above` b``",+ "raw": "above : Element -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "absolute",+ "comment": "",+ "raw": "absolute : Int -\u003e Pos",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Pos"+ ]+ ]+ },+ {+ "name": "below",+ "comment": "Stack elements vertically.\nTo put `a` below `b` you would say: ``a `below` b``",+ "raw": "below : Element -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "beside",+ "comment": "Put elements beside each other horizontally.\nTo put `a` beside `b` you would say: ``a `beside` b``",+ "raw": "beside : Element -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "bottomLeft",+ "comment": "",+ "raw": "bottomLeft : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "bottomLeftAt",+ "comment": "",+ "raw": "bottomLeftAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "bottomRight",+ "comment": "",+ "raw": "bottomRight : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "bottomRightAt",+ "comment": "",+ "raw": "bottomRightAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "color",+ "comment": "Create an `Element` with a given background color.",+ "raw": "color : Color -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Color"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "container",+ "comment": "Put an element in a container. This lets you position the element really\neasily, and there are tons of ways to set the `Position`.\nTo center `element` exactly in a 300-by-300 square you would say:\n\n container 300 300 middle element\n\nBy setting the color of the container, you can create borders.",+ "raw": "container : Int -\u003e Int -\u003e Position -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Position"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "croppedImage",+ "comment": "Create a cropped image. Take a rectangle out of the picture starting\nat the given top left coordinate. If you have a 140-by-140 image,\nthe following will cut a 100-by-100 square out of the middle of it.\n\n croppedImage (20,20) 100 100 \"yogi.jpg\"",+ "raw": "croppedImage : (Int,Int) -\u003e Int -\u003e Int -\u003e String -\u003e Element",+ "type": [+ "-\u003e",+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "down",+ "comment": "",+ "raw": "down : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "fittedImage",+ "comment": "Create a fitted image given a width, height, and image source.\nThis will crop the picture to best fill the given dimensions.",+ "raw": "fittedImage : Int -\u003e Int -\u003e String -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ },+ {+ "name": "flow",+ "comment": "Have a list of elements flow in a particular direction.\nThe `Direction` starts from the first element in the list.\n\n flow right [a,b,c]\n\n +---+---+---+\n | a | b | c |\n +---+---+---+",+ "raw": "flow : Direction -\u003e [Element] -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Direction"+ ],+ [+ "-\u003e",+ [+ "_List",+ [+ "Element"+ ]+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "height",+ "comment": "Create an `Element` with a given height.",+ "raw": "height : Int -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "heightOf",+ "comment": "Get the height of an Element",+ "raw": "heightOf : Element -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Int"+ ]+ ]+ },+ {+ "name": "image",+ "comment": "Create an image given a width, height, and image source.",+ "raw": "image : Int -\u003e Int -\u003e String -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ },+ {+ "name": "inward",+ "comment": "",+ "raw": "inward : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "layers",+ "comment": "Layer elements on top of each other, starting from the bottom:\n`layers == flow outward`",+ "raw": "layers : [Element] -\u003e Element",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "Element"+ ]+ ],+ [+ "Element"+ ]+ ]+ },+ {+ "name": "left",+ "comment": "",+ "raw": "left : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "link",+ "comment": "Create an `Element` that is a hyper-link.",+ "raw": "link : String -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "midBottom",+ "comment": "",+ "raw": "midBottom : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "midBottomAt",+ "comment": "",+ "raw": "midBottomAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "midLeft",+ "comment": "",+ "raw": "midLeft : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "midLeftAt",+ "comment": "",+ "raw": "midLeftAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "midRight",+ "comment": "",+ "raw": "midRight : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "midRightAt",+ "comment": "",+ "raw": "midRightAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "midTop",+ "comment": "",+ "raw": "midTop : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "midTopAt",+ "comment": "",+ "raw": "midTopAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "middle",+ "comment": "",+ "raw": "middle : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "middleAt",+ "comment": "",+ "raw": "middleAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "opacity",+ "comment": "Create an `Element` with a given opacity. Opacity is a number between 0 and 1\nwhere 0 means totally clear.",+ "raw": "opacity : Float -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "outward",+ "comment": "",+ "raw": "outward : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "relative",+ "comment": "",+ "raw": "relative : Float -\u003e Pos",+ "type": [+ "-\u003e",+ [+ "Float"+ ],+ [+ "Pos"+ ]+ ]+ },+ {+ "name": "right",+ "comment": "",+ "raw": "right : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "size",+ "comment": "Create an `Element` with a new width and height.",+ "raw": "size : Int -\u003e Int -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ },+ {+ "name": "sizeOf",+ "comment": "Get the width and height of an Element",+ "raw": "sizeOf : Element -\u003e (Int,Int)",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "_Tuple2",+ [+ "Int"+ ],+ [+ "Int"+ ]+ ]+ ]+ },+ {+ "name": "spacer",+ "comment": "Create an empty box. This is useful for getting your spacing right and\nfor making borders.",+ "raw": "spacer : Int -\u003e Int -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "tag",+ "comment": "Create an `Element` with a tag. This lets you link directly to it.\nThe element `(tag \"all-about-badgers\" thirdParagraph)` can be reached\nwith a link lik this: `/facts-about-animals.elm#all-about-badgers`",+ "raw": "tag : String -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "tiledImage",+ "comment": "",+ "raw": "tiledImage : Int -\u003e Int -\u003e String -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ },+ {+ "name": "topLeft",+ "comment": "",+ "raw": "topLeft : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "topLeftAt",+ "comment": "",+ "raw": "topLeftAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "topRight",+ "comment": "",+ "raw": "topRight : Position",+ "type": [+ "Position"+ ]+ },+ {+ "name": "topRightAt",+ "comment": "",+ "raw": "topRightAt : Pos -\u003e Pos -\u003e Position",+ "type": [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "-\u003e",+ [+ "Pos"+ ],+ [+ "Position"+ ]+ ]+ ]+ },+ {+ "name": "up",+ "comment": "",+ "raw": "up : Direction",+ "type": [+ "Direction"+ ]+ },+ {+ "name": "width",+ "comment": "Create an `Element` with a given width.",+ "raw": "width : Int -\u003e Element -\u003e Element",+ "type": [+ "-\u003e",+ [+ "Int"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ },+ {+ "name": "widthOf",+ "comment": "Get the width of an Element",+ "raw": "widthOf : Element -\u003e Int",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Int"+ ]+ ]+ }+ ]+},+{+ "name": "Graphics.Input",+ "document": "This module is for creating standard input widgets such as buttons and\ntext boxes. In general, functions in this library return a signal representing\nevents from the user.\n\nThe simplest inputs are *one-way inputs*, meaning the user can update\nthem, but the programmer cannot. If you need to update an input from\nwithin the program you want the slightly more complex *two-way inputs*.\nThis document will always show the one-way inputs first, *then* the\ntwo-way inputs.\n\n# Buttons\n@docs button, customButton, buttons, customButtons\n\n# Fields\n@docs field, password, email, fields, FieldState, emptyFieldState\n\n# Checkboxes\n@docs checkbox, checkboxes\n\n# Drop Downs\n@docs stringDropDown, dropDown\n\n# Mouse Hover\n@docs hoverable, hoverables",+ "aliases": [+ {+ "name": "FieldState",+ "comment": "Represents the current state of a text field. The `string` represents the\ncharacters filling the text field. The `selectionStart` and `selectionEnd`\nvalues represent what the user has selected with their mouse or keyboard.\nFor example:\n\n { string=\"She sells sea shells\", selectionStart=3, selectionEnd=0 }\n\nThis means the user highlighted the substring `\"She\"` backwards.",+ "raw": "type FieldState = { string:String, selectionStart:Int, selectionEnd:Int }",+ "typeVariables": [],+ "type": {+ "selectionEnd": [+ "Int"+ ],+ "selectionStart": [+ "Int"+ ],+ "string": [+ "String"+ ]+ }+ }+ ],+ "datatypes": [],+ "values": [+ {+ "name": "button",+ "comment": "Create a button with a given label. The result is an `Element` and\na signal of units. This signal triggers whenever the button is pressed.",+ "raw": "button : String -\u003e (Element, Signal ())",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_Tuple2",+ [+ "Element"+ ],+ [+ "Signal",+ [+ "_Tuple0"+ ]+ ]+ ]+ ]+ },+ {+ "name": "buttons",+ "comment": "Create a group of buttons.\n\n * The first argument is the default value of the `events` signal.\n * The `events` signal represents all of the activity in this group\n of buttons.\n * The `button` function creates a button\n with the given name, like “Submit” or “Cancel”.\n The `a` value is sent to `events` whenever the button is pressed.",+ "raw": "buttons : a -\u003e { events : Signal a,\n button : a -\u003e String -\u003e Element }",+ "type": [+ "-\u003e",+ "a",+ {+ "events": [+ "Signal",+ "a"+ ],+ "button": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "Element"+ ]+ ]+ ]+ }+ ]+ },+ {+ "name": "checkbox",+ "comment": "Create a checkbox with a given start state. Unlike `button`, this\nresult is a *signal* of elements. That is because a checkbox has state\nthat updates based on user input. The boolean signal represents the\ncurrent state of the checkbox.",+ "raw": "checkbox : Bool -\u003e (Signal Element, Signal Bool)",+ "type": [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ [+ "Bool"+ ]+ ]+ ]+ ]+ },+ {+ "name": "checkboxes",+ "comment": "Create a group of checkboxes.\n\n * The first argument is the default value of the `events` signal.\n * The `events` signal represents all of the activity in this group\n of checkboxes.\n * The `checkbox` function creates a\n checkbox with a given state. The `(Bool -\u003e a)` function is used\n when the checkbox is modified. It takes the new state and turns\n it into a value that can be sent to `events`. For example, this\n lets you add an ID to distinguish between checkboxes.",+ "raw": "checkboxes : a -\u003e { events : Signal a,\n checkbox : (Bool -\u003e a) -\u003e Bool -\u003e Element }",+ "type": [+ "-\u003e",+ "a",+ {+ "events": [+ "Signal",+ "a"+ ],+ "checkbox": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Bool"+ ],+ "a"+ ],+ [+ "-\u003e",+ [+ "Bool"+ ],+ [+ "Element"+ ]+ ]+ ]+ }+ ]+ },+ {+ "name": "customButton",+ "comment": "Create a button with custom states for up, hovering, and down\n(given in that order). The result is an `Element` and a signal of\nunits. This signal triggers whenever the button is pressed.",+ "raw": "customButton : Element -\u003e Element -\u003e Element -\u003e (Element, Signal ())",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "_Tuple2",+ [+ "Element"+ ],+ [+ "Signal",+ [+ "_Tuple0"+ ]+ ]+ ]+ ]+ ]+ ]+ },+ {+ "name": "customButtons",+ "comment": "Create a group of custom buttons.\n\n * The first argument is the default value of the `events` signal.\n * The `events` signal represents all of the activity in this group\n of custom buttons.\n * The `customButton` function creates a button with three different visual\n states, one for up, hovering, and down. The resulting button has dimensions\n large enough to fit all three possible `Elements`.\n The `a` value is sent to `events` whenever the button is pressed.",+ "raw": "customButtons : a -\u003e { events : Signal a,\n customButton : a -\u003e Element -\u003e Element -\u003e Element -\u003e Element }",+ "type": [+ "-\u003e",+ "a",+ {+ "customButton": [+ "-\u003e",+ "a",+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ ],+ "events": [+ "Signal",+ "a"+ ]+ }+ ]+ },+ {+ "name": "dropDown",+ "comment": "Create a drop-down menu. When the user selects a string,\nthe current state of the drop-down is set to the associated\nvalue. This lets you avoid manually mapping the string onto\nfunctions and values.",+ "raw": "dropDown : [(String,a)] -\u003e (Signal Element, Signal a)",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "_Tuple2",+ [+ "String"+ ],+ "a"+ ]+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ "a"+ ]+ ]+ ]+ },+ {+ "name": "email",+ "comment": "Same as `field` but it adds an annotation that this field is for email\naddresses. This is helpful for auto-complete and for mobile users who may\nget a custom keyboard with an `@` and `.com` button.",+ "raw": "email : String -\u003e (Signal Element, Signal String)",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "emptyFieldState",+ "comment": "The empty field state:\n\n { string=\"\", selectionStart=0, selectionEnd=0 }",+ "raw": "emptyFieldState : FieldState",+ "type": [+ "FieldState"+ ]+ },+ {+ "name": "field",+ "comment": "Create a field with the given default text. The output is an element\nthat updates to match the user input and a signal of strings representing\nthe content of the field.",+ "raw": "field : String -\u003e (Signal Element, Signal String)",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "fields",+ "comment": "Create a group of text input fields.\n\n * The first argument is the default value of the `events` signal.\n * The `events` signal represents all of the activity in this group\n of text fields.\n * The `field` function creates a\n field with the given ghost text and initial field state.\n When the field is modified, the `(FieldState -\u003e a)` function\n takes the new state and turns\n it into a value that can be sent to `events`. For example, this\n lets you add an ID to distinguish between input fields.",+ "raw": "fields : a -\u003e { events : Signal a,\n field : (FieldState -\u003e a) -\u003e String -\u003e FieldState -\u003e Element }",+ "type": [+ "-\u003e",+ "a",+ {+ "events": [+ "Signal",+ "a"+ ],+ "field": [+ "-\u003e",+ [+ "-\u003e",+ [+ "FieldState"+ ],+ "a"+ ],+ [+ "-\u003e",+ [+ "String"+ ],+ [+ "-\u003e",+ [+ "FieldState"+ ],+ [+ "Element"+ ]+ ]+ ]+ ]+ }+ ]+ },+ {+ "name": "hoverable",+ "comment": "Detect when the mouse is hovering over a specifici `Element`.",+ "raw": "hoverable : Element -\u003e (Element, Signal Bool)",+ "type": [+ "-\u003e",+ [+ "Element"+ ],+ [+ "_Tuple2",+ [+ "Element"+ ],+ [+ "Signal",+ [+ "Bool"+ ]+ ]+ ]+ ]+ },+ {+ "name": "hoverables",+ "comment": "Detect when the mouse is hovering over some elements. This\nallows you to create and destroy elements dynamically and still\ndetect hover information.",+ "raw": "hoverables : a -\u003e { events : Signal a,\n hoverable : (Bool -\u003e a) -\u003e Element -\u003e Element }",+ "type": [+ "-\u003e",+ "a",+ {+ "hoverable": [+ "-\u003e",+ [+ "-\u003e",+ [+ "Bool"+ ],+ "a"+ ],+ [+ "-\u003e",+ [+ "Element"+ ],+ [+ "Element"+ ]+ ]+ ],+ "events": [+ "Signal",+ "a"+ ]+ }+ ]+ },+ {+ "name": "password",+ "comment": "Same as `field` but the UI element blocks out each characters.",+ "raw": "password : String -\u003e (Signal Element, Signal String)",+ "type": [+ "-\u003e",+ [+ "String"+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ [+ "String"+ ]+ ]+ ]+ ]+ },+ {+ "name": "stringDropDown",+ "comment": "Create a drop-down menu for selecting strings. The resulting\nsignal of strings represents the string that is currently selected.",+ "raw": "stringDropDown : [String] -\u003e (Signal Element, Signal String)",+ "type": [+ "-\u003e",+ [+ "_List",+ [+ "String"+ ]+ ],+ [+ "_Tuple2",+ [+ "Signal",+ [+ "Element"+ ]+ ],+ [+ "Signal",+ [+ "String"+ ]+ ]+ ]+ ]+ }+ ]+},+{+ "name": "JavaScript.Experimental",+ "document": "A pair of very experimental functions for converting between\nElm records and JavaScript objects. It currently uses a best effort\nconversion that can cause runtime errors. This API should change and\nimprove as we find its key failings.\n\n# Converting between Elm records and JS Objects\n@docs toRecord, fromRecord",+ "aliases": [],+ "datatypes": [],+ "values": [+ {+ "name": "fromRecord",+ "comment": "Turn arbitrary Elm records into JavaScript objects.\nLists become arrays, nested records are allowed. No ADTs.\n\n -- OK records\n { student=\"Steve\", scores=[83,94,99,72] }\n { errorLevel=10, critical=True }\n\n -- BAD records\n { answer = Nothing }\n { result = Left \"An error occurred\" }",+ "raw": "fromRecord : a -\u003e JSObject",+ "type": [+ "-\u003e",+ "a",+ [+ "JSObject"+ ]+ ]+ },+ {+ "name": "toRecord",+ "comment": "Turn arbitrary JavaScript objects into Elm records.\nArrays are converted into lists, nested objects are allowed.\nNo `null` values or non-homogeneous arrays.\n\n -- OK objects\n { student:\"Steve\", scores:[83,94,99,72] }\n { errorLevel:10, critical:true }\n\n -- BAD objects\n { answer:null }\n { info:[true,42,'what'] }",+ "raw": "toRecord : JSObject -\u003e a",+ "type": [+ "-\u003e",+ [+ "JSObject"+ ],+ "a"+ ]+ }+ ]+}+]
data/elm-runtime.js view
@@ -1,5757 +1,7031 @@-Elm = {}; Elm.Native = {}; Elm.Native.Graphics = {};-Elm.Graphics = {}; ElmRuntime = {}; ElmRuntime.Render = {};-Elm = {}; Elm.Native = {}; Elm.Native.Graphics = {};-Elm.Graphics = {}; ElmRuntime = {}; ElmRuntime.Render = {}--Elm.Native.Basics = function(elm) {- 'use strict';- if (elm.Native.Basics) return elm.Native.Basics;-- var JS = Elm.Native.JavaScript(elm);- // var Maybe = Elm.Maybe(elm);- var Utils = Elm.Native.Utils(elm);- //var Char = Elm.Char(elm);-- function div(a,b) { return (a/b)|0; }- function rem(a,b) { return a % b; }- var mod = Utils.mod;- function abs(x) { return x < 0 ? -x : x; }- function logBase(base,n) { return Math.log(n) / Math.log(base); }- function min(a,b) { return Utils.cmp(a,b) < 0 ? a : b; }- function max(a,b) { return Utils.cmp(a,b) > 0 ? a : b; }- function clamp(lo,hi,n) {- return Utils.cmp(n,lo) < 0 ? lo : Utils.cmp(n,hi) > 0 ? hi : n; }- function xor(a,b) { return a !== b; }- function not(b) { return !b; }-- function truncate(n) { return n|0; }-- function curry(f,a,b) { return f(Utils.Tuple2(a,b)); }- function uncurry(f,v) { return A2(f,v._0,v._1); }- function fst(t) { return t._0; }- function snd(t) { return t._1; }-/*- function readInt(str) {- var s = JS.fromString(str);- var len = s.length;- if (len === 0) { return Maybe.Nothing; }- var start = 0;- if (s[0] == '-') {- if (len === 1) { return Maybe.Nothing; }- start = 1;- }- for (var i = start; i < len; ++i) {- if (!Char.isDigit(s[i])) { return Maybe.Nothing; }- }- return Maybe.Just(parseInt(s, 10));- }-- function readFloat(str) {- var s = JS.fromString(str);- var len = s.length;- if (len === 0) { return Maybe.Nothing; }- var start = 0;- if (s[0] == '-') {- if (len === 1) { return Maybe.Nothing; }- start = 1;- }- var dotCount = 0;- for (var i = start; i < len; ++i) {- if (Char.isDigit(s[i])) { continue; }- if (s[i] === '.') {- dotCount += 1;- if (dotCount <= 1) { continue; }- }- return Maybe.Nothing;- }- return Maybe.Just(parseFloat(s));- }-*/- var basics = {- div:F2(div),- rem:F2(rem),- mod:mod,-- pi:Math.PI,- e:Math.e,- cos:Math.cos,- sin:Math.sin,- tan:Math.tan,- acos:Math.acos,- asin:Math.asin,- atan:Math.atan,- atan2:F2(Math.atan2),-- sqrt:Math.sqrt,- abs:abs,- logBase:F2(logBase),- min:F2(min),- max:F2(max),- clamp:F3(clamp),- compare:Utils.compare,-- xor:F2(xor),- not:not,-- truncate:truncate,- ceiling:Math.ceil,- floor:Math.floor,- round:Math.round,- toFloat:function(x) { return x; },-- //readInt:readInt,- //readFloat:readFloat,-- curry:F3(curry),- uncurry:F2(uncurry),- fst:fst,- snd:snd- };-- return elm.Native.Basics = basics;-};--Elm.Native.Char = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Char) return elm.Native.Char;-- function isBetween(lo,hi) { return function(chr) {- var c = chr.charCodeAt(0);- return lo <= c && c <= hi;- };- }- var isDigit = isBetween('0'.charCodeAt(0),'9'.charCodeAt(0));- var chk1 = isBetween('a'.charCodeAt(0),'f'.charCodeAt(0));- var chk2 = isBetween('A'.charCodeAt(0),'F'.charCodeAt(0));-- return elm.Native.Char = {- fromCode : function(c) { return String.fromCharCode(c); },- toCode : function(c) { return c.charCodeAt(0); },- toUpper : function(c) { return c.toUpperCase(); },- toLower : function(c) { return c.toLowerCase(); },- toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },- toLocaleLower : function(c) { return c.toLocaleLowerCase(); },- isLower : isBetween('a'.charCodeAt(0),'z'.charCodeAt(0)),- isUpper : isBetween('A'.charCodeAt(0),'Z'.charCodeAt(0)),- isDigit : isDigit,- isOctDigit : isBetween('0'.charCodeAt(0),'7'.charCodeAt(0)),- isHexDigit : function(c) { return isDigit(c) || chk1(c) || chk2(c); }- };--};---Elm.Native.Color = function(elm) {- "use strict";-- elm.Native = elm.Native || {};- if (elm.Native.Color) return elm.Native.Color;-- var Utils = Elm.Native.Utils(elm);-- function complement(rgb) {- var hsv = toHSV(rgb);- hsv.hue = (hsv.hue + 180) % 360;- return toRGB(hsv);- }-- function hsva(h,s,v,a) {- var degree = A2(Utils.mod, h * 180 / Math.PI, 360);- var clr = toRGB({hue:degree, saturation:s, value:v});- clr._3 = a;- return clr;- }-- function hsv(h,s,v) {- var degree = A2(Utils.mod, h * 180 / Math.PI, 360);- return toRGB({hue:degree, saturation:s, value:v});- }-- function toHSV(rgb) {- var hsv = {};- var r = rgb._0 / 255.0, g = rgb._1 / 255.0, b = rgb._2 / 255.0;- var M = Math.max(r,g,b);- var m = Math.min(r,g,b);- var c = M - m;-- var h = 0;- if (c === 0) { h = 0; }- else if (M === r) { h = ((g - b) / c) % 6; }- else if (M === g) { h = ((b - r) / c) + 2; }- else if (M === b) { h = ((r - g) / c) + 4; }- h *= 60;-- return { value : M, hue : h, saturation : (M === 0 ? 0 : c / M) };- }-- function between(lo,hi,x) { return lo <= x && x < hi; }- function norm(n) { return Math.round(n*255); }-- function toRGB(hsv) {- var c = hsv.value * hsv.saturation;- var hue = hsv.hue / 60;- var x = c * (1 - Math.abs((hue % 2) - 1));- var r = 0, g = 0, b = 0;- if (between(0,1,hue)) { r = c; g = x; b = 0; }- else if (between(1,2,hue)) { r = x; g = c; b = 0; }- else if (between(2,3,hue)) { r = 0; g = c; b = x; }- else if (between(3,4,hue)) { r = 0; g = x; b = c; }- else if (between(4,5,hue)) { r = x; g = 0; b = c; }- else if (between(5,6,hue)) { r = c; g = 0; b = x; }-- var m = hsv.value - c;- return { ctor:"Color", _0:norm(r+m), _1:norm(g+m), _2:norm(b+m), _3:1 };- }-- return elm.Native.Color = {- hsva:F4(hsva),- hsv:F3(hsv),- complement:complement- };--};-Elm.Native.Date = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Date) return elm.Native.Date;-- var JS = Elm.JavaScript(elm);- var Maybe = Elm.Maybe(elm);-- function dateNow() { return new window.Date; }- function readDate(str) {- var d = new window.Date(JS.fromString(str));- if (isNaN(d.getTime())) return Maybe.Nothing;- return Maybe.Just(d);- }-- var dayTable = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];- var monthTable = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; -- return elm.Native.Date = {- read : readDate,- year : function(d) { return d.getFullYear(); },- month : function(d) { return { ctor:monthTable[d.getMonth()] }; },- day : function(d) { return d.getDate(); },- hour : function(d) { return d.getHours(); },- minute : function(d) { return d.getMinutes(); },- second : function(d) { return d.getSeconds(); },- toTime : function(d) { return d.getTime(); },- dayOfWeek : function(d) { return { ctor:dayTable[d.getDay()] }; }- };--};--Elm.Native.Error = function(elm) {- 'use strict';- elm.Native = elm.Native || {};- if (elm.Native.Error) return elm.Native.Error;-- var fromString = Elm.Native.JavaScript(elm).fromString;-- function indent(lines) {- var msg = '';- for (var i = 0; i < lines.length; ++i) {- msg += '<br/> ' + lines[i];- }- return msg;- }-- function Case(moduleName, span) { - var msg = indent(['Non-exhaustive pattern match in case-expression.',- 'Make sure your patterns cover every case!']);- throw new Error('Runtime error in module ' + moduleName + ' (' + span + '):' + msg);- }-- function If(moduleName, span) { - var msg = indent(['Non-exhaustive pattern match in multi-way-if expression.',- 'It is best to use \'otherwise\' as the last branch of multi-way-if.']);- throw new Error('Runtime error in module ' + moduleName + ' (' + span + '):' + msg);- }-- function raise(str) { throw new Error(fromString(str)); }-- return elm.Native.Error = { Case: Case, If: If, raise: raise };-};-function F2(fun) {- function wrapper(a) { return function(b) { return fun(a,b) } }- wrapper.arity = 2;- wrapper.func = fun;- return wrapper;-}--function F3(fun) {- function wrapper(a) {- return function(b) { return function(c) { return fun(a,b,c) }}- }- wrapper.arity = 3;- wrapper.func = fun;- return wrapper;-}--function F4(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return fun(a,b,c,d) }}}- }- wrapper.arity = 4;- wrapper.func = fun;- return wrapper;-}--function F5(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return function(e) { return fun(a,b,c,d,e) }}}}- }- wrapper.arity = 5;- wrapper.func = fun;- return wrapper;-}--function F6(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return function(e) { return function(f) {- return fun(a,b,c,d,e,f) }}}}}- }- wrapper.arity = 6;- wrapper.func = fun;- return wrapper;-}--function F7(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return function(e) { return function(f) {- return function(g) { return fun(a,b,c,d,e,f,g) }}}}}}- }- wrapper.arity = 7;- wrapper.func = fun;- return wrapper;-}--function F8(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return function(e) { return function(f) {- return function(g) { return function(h) {return fun(a,b,c,d,e,f,g,h)}}}}}}}- }- wrapper.arity = 8;- wrapper.func = fun;- return wrapper;-}--function F9(fun) {- function wrapper(a) { return function(b) { return function(c) {- return function(d) { return function(e) { return function(f) {- return function(g) { return function(h) { return function(i) {- return fun(a,b,c,d,e,f,g,h,i) }}}}}}}}- }- wrapper.arity = 9;- wrapper.func = fun;- return wrapper;-}--function A2(fun,a,b) {- return fun.arity === 2 ? fun.func(a,b) : fun(a)(b);-}-function A3(fun,a,b,c) {- return fun.arity === 3 ? fun.func(a,b,c) : fun(a)(b)(c);-}-function A4(fun,a,b,c,d) {- return fun.arity === 4 ? fun.func(a,b,c,d) : fun(a)(b)(c)(d);-}-function A5(fun,a,b,c,d,e) {- return fun.arity === 5 ? fun.func(a,b,c,d,e) : fun(a)(b)(c)(d)(e);-}-function A6(fun,a,b,c,d,e,f) {- return fun.arity === 6 ? fun.func(a,b,c,d,e,f) : fun(a)(b)(c)(d)(e)(f);-}-function A7(fun,a,b,c,d,e,f,g) {- return fun.arity === 7 ? fun.func(a,b,c,d,e,f,g) : fun(a)(b)(c)(d)(e)(f)(g);-}-function A8(fun,a,b,c,d,e,f,g,h) {- return fun.arity === 8 ? fun.func(a,b,c,d,e,f,g,h) : fun(a)(b)(c)(d)(e)(f)(g)(h);-}-function A9(fun,a,b,c,d,e,f,g,h,i) {- return fun.arity === 9 ? fun.func(a,b,c,d,e,f,g,h,i)- : fun(a)(b)(c)(d)(e)(f)(g)(h)(i);-}--Elm.Native.JavaScript = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.JavaScript) return elm.Native.JavaScript;-- var List = Elm.Native.List(elm);- var Render = ElmRuntime.use(ElmRuntime.Render.Element);-- function fromJS(v) {- var type = typeof v;- if (type === 'number' ) return v;- if (type === 'boolean') return v;- if (type === 'string' ) return List.fromArray(v);- if (v instanceof Array) {- var arr = [];- var len = v.length;- for (var i = 0; i < len; ++i) {- var x = fromJS(v[i]);- if (x !== null) arr.push(x);- }- return List.fromArray(arr);- }- if (type === 'object') {- var rec = { _:{} };- for (var f in v) {- var x = fromJS(v[f]);- if (x !== null) rec[f] = x;- }- return rec;- }- return null;- }-- function toJS(v) {- var type = typeof v;- if (type === 'number' || type === 'boolean') return v;- if (type === 'object' && '_' in v) {- var obj = {};- for (var k in v) {- var x = toJS(v[k]);- if (x !== null) obj[k] = x;- }- return obj;- }- if (type === 'object' && (v.ctor === '::' || v.ctor === '[]')) {- var array = List.toArray(v);- if (typeof array[0] === 'string') {- array = array.join('');- } else {- for (var i = array.length; i--; ) {- array[i] = toJS(array[i]);- }- }- return array;- }- return null;- }-- function fromRecord(r) {- if (typeof r === 'object' && '_' in r) {- return toJS(r);- }- throw new Error("'fromRecord' must be called on a record.");- }-- function id(n) { return n; }-- function toElement(w,h,domNode) {- return A3( newElement, w, h, {- ctor: 'Custom',- type: 'DomNode',- render: function(node) { return node; },- update: function(node,oldNode,newNode) {- if (node === newNode) return;- node.parentNode.replaceChild(newNode, node);- },- model: domNode- });- }-- function fromElement(element) {- return Render.render(element);- }-- return elm.Native.JavaScript = {- toFloat : id,- toBool : id,- toInt : function(n) { return n|0; },- toString : List.fromArray,- toList : List.fromArray,- fromString : function(s) { return List.toArray(s).join(''); },- fromList : List.toArray,- fromInt : id,- fromFloat : id,- fromBool : id,-- toElement : toElement,- fromElement : fromElement,- toRecord : fromJS,- fromRecord : fromRecord- };--};--Elm.Native.Json = function(elm) {- 'use strict';-- var Maybe = Elm.Maybe(elm);- var Dict = Elm.Dict(elm);- var List = Elm.List(elm);- var JS = Elm.JavaScript(elm);- var Utils = Elm.Native.Utils(elm);-- function fromValue(v) {- switch (v.ctor) {- case 'Null' : return null;- case 'String' : return JS.fromString(v._0);- case 'Object' :- var obj = {};- var array = JS.fromList(Dict.toList(v._0));- for (var i = array.length; i--; ) {- obj[JS.fromString(array[i]._0)] = fromValue(array[i]._1);- }- return obj;- case 'Array' :- var array = JS.fromList(v._0);- for (var i = array.length; i--; ) {- array[i] = fromValue(array[i]);- }- return array;- default :- return v._0;- }- }-- function toPrettyJSString(sep, obj) {- return JSON.stringify(fromValue(obj), null, JS.fromString(sep));- }-- function toValue(v) {- switch (typeof v) {- case 'string' : return { ctor:"String", _0: JS.toString(v) };- case 'number' : return { ctor:"Number", _0: JS.toFloat(v) };- case 'boolean': return { ctor:"Bool" , _0: JS.toBool(v) };- case 'object' :- if (v === null) return { ctor:"Null" };- if (v instanceof Array) {- for (var i = v.length; i--; ) { v[i] = toValue(v[i]); }- return { ctor:"Array", _0: JS.toList(v) };- }- var array = [];- for (var k in v) array.push(Utils.Tuple2(JS.toString(k), toValue(v[k])));- return { ctor:"Object", _0: Dict.fromList(JS.toList(array)) };- }- }-- function fromJSString(str) {- try {- return Maybe.Just(toValue(JSON.parse(str)));- } catch (e) {- return Maybe.Nothing;- }- }-- return elm.Native.Json = {- toJSString : F2(toPrettyJSString),- fromJSString : fromJSString,- toJSObject : fromValue,- fromJSObject : toValue- };--};-Elm.Native.List = function(elm) {- "use strict";-- elm.Native = elm.Native || {};- if (elm.Native.List) return elm.Native.List;- if ('values' in Elm.Native.List)- return elm.Native.List = Elm.Native.List.values;-- var Utils = Elm.Native.Utils(elm);-- // TODO: Improve Nil handling- // We can change places like: if (xs.ctor === '[]') ... to if (xs === Nil) ...- // but only if we're confident Nil can only be defined once.- // Currently (27Mar2013) each module can have different instantiations, so multiple Nil objects can exist- // (and if they're used interchangeably then direct object comparison fails where ctor doesn't).- // So, this can only be fixed when modules initialisation is also fixed.- // The performance overhead of the .ctor calls is 5-10% according to jsperf (depending on fn + list size)- // (on firefox 19)-- var Nil = { ctor:'[]' };-- // using freeze for every cons would be nice but is a huge (9x on firefox 19)- // performance penalty- function Cons(hd,tl) { return { ctor:"::", _0:hd, _1:tl }; }-- function throwError(f) {- throw new Error("Function '" + f + "' expects a non-empty list!");- }-- function toArray(xs) {- var out = [];- while (xs.ctor !== '[]') {- out.push(xs._0);- xs = xs._1;- }- return out;- }-- function fromArray(arr) {- var out = Nil;- for (var i = arr.length; i--; ) {- out = Cons(arr[i], out);- }- return out;- }-- function range(lo,hi) {- var lst = Nil;- if (lo <= hi) {- do { lst = Cons(hi,lst) } while (hi-->lo);- }- return lst- }-- function append(xs,ys) {- if (typeof xs === "string") { return xs.concat(ys); }- if (xs.ctor === '[]') { return ys; }- var root = Cons(xs._0, Nil);- var curr = root;- xs = xs._1;- while (xs.ctor !== '[]') {- curr._1 = Cons(xs._0, Nil);- xs = xs._1;- curr = curr._1;- }- curr._1 = ys;- return root;- }-- function head(v) { return v.ctor === '[]' ? throwError('head') : v._0; }- function tail(v) { return v.ctor === '[]' ? throwError('tail') : v._1; }-- function last(xs) {- if (xs.ctor === '[]') { throwError('last'); }- var out = xs._0;- while (xs.ctor !== '[]') {- out = xs._0;- xs = xs._1;- }- return out;- }-- function map(f, xs) {- var arr = [];- while (xs.ctor !== '[]') {- arr.push(f(xs._0));- xs = xs._1;- }- return fromArray(arr);- }-- // f defined similarly for both foldl and foldr (NB: different from Haskell)- // ie, foldl : (a -> b -> b) -> b -> [a] -> b- function foldl(f, b, xs) {- var acc = b;- while (xs.ctor !== '[]') {- acc = A2(f, xs._0, acc);- xs = xs._1;- }- return acc;- }-- function foldr(f, b, xs) {- var arr = toArray(xs);- var acc = b;- for (var i = arr.length; i--; ) {- acc = A2(f, arr[i], acc);- }- return acc;- }-- function foldl1(f, xs) {- return xs.ctor === '[]' ? throwError('foldl1') : foldl(f, xs._0, xs._1);- }-- function foldr1(f, xs) {- if (xs.ctor === '[]') { throwError('foldr1'); }- var arr = toArray(xs);- var acc = arr.pop();- for (var i = arr.length; i--; ) {- acc = A2(f, arr[i], acc);- }- return acc;- }-- function scanl(f, b, xs) {- var arr = toArray(xs);- arr.unshift(b);- var len = arr.length;- for (var i = 1; i < len; ++i) {- arr[i] = A2(f, arr[i], arr[i-1]);- }- return fromArray(arr);- }-- function scanl1(f, xs) {- return xs.ctor === '[]' ? throwError('scanl1') : scanl(f, xs._0, xs._1);- }-- function filter(pred, xs) {- var arr = [];- while (xs.ctor !== '[]') {- if (pred(xs._0)) { arr.push(xs._0); }- xs = xs._1;- }- return fromArray(arr);- }-- function length(xs) {- var out = 0;- while (xs.ctor !== '[]') {- out += 1;- xs = xs._1;- }- return out;- }-- function member(x, xs) {- while (xs.ctor !== '[]') {- if (Utils.eq(x,xs._0)) return true;- xs = xs._1;- }- return false;- }-- function reverse(xs) { return fromArray(toArray(xs).reverse()); }-- function concat(xss) {- if (xss.ctor === '[]') return xss;- var arr = toArray(xss);- var xs = arr[arr.length-1];- for (var i = arr.length-1; i--; ) {- xs = append(arr[i], xs);- }- return xs;- }-- function all(pred, xs) {- while (xs.ctor !== '[]') {- if (!pred(xs._0)) return false;- xs = xs._1;- }- return true;- }-- function any(pred, xs) {- while (xs.ctor !== '[]') {- if (pred(xs._0)) return true;- xs = xs._1;- }- return false;- }-- function zipWith(f, xs, ys) {- var arr = [];- while (xs.ctor !== '[]' && ys.ctor !== '[]') {- arr.push(A2(f, xs._0, ys._0));- xs = xs._1;- ys = ys._1;- }- return fromArray(arr);- }-- function zip(xs, ys) {- var arr = [];- while (xs.ctor !== '[]' && ys.ctor !== '[]') {- arr.push(Utils.Tuple2(xs._0, ys._0));- xs = xs._1;- ys = ys._1;- }- return fromArray(arr);- }-- function sort(xs) {- function cmp(a,b) {- var ord = Utils.compare(a,b).ctor;- return ord=== 'EQ' ? 0 : ord === 'LT' ? -1 : 1;- }- return fromArray(toArray(xs).sort(cmp));- }-- function nth(xs, n) {- return toArray(xs)[n];- }-- function take(n, xs) {- var arr = [];- while (xs.ctor !== '[]' && n > 0) {- arr.push(xs._0);- xs = xs._1;- --n;- }- return fromArray(arr);- }-- function drop(n, xs) {- while (xs.ctor !== '[]' && n > 0) {- xs = xs._1;- --n;- }- return xs;- }-- function join(sep, xss) {- if (typeof sep === 'string') return toArray(xss).join(sep);- if (xss.ctor === '[]') return Nil;- var s = toArray(sep);- var out = toArray(xss._0);- xss = xss._1;- while (xss.ctor !== '[]') {- out = out.concat(s, toArray(xss._0));- xss = xss._1;- }- return fromArray(out);- }-- function split(seperator, list) {- var array = toArray(list);- var alen = array.length;- if (alen === 0) {- // splitting an empty list is a list of lists: [[]]- return Cons(Nil,Nil);- }-- var sep = toArray(seperator);- var seplen = sep.length;- if (seplen === 0) {- // splitting with an empty sep is a list of all elements- // Same as (map (\x -> [x]) list)- var out = Nil;- for (var i = alen; i--; ) {- out = Cons(Cons(array[i],Nil), out);- }- return out;- }-- var matches = [-seplen];- var sepStart = sep[0];- var len = alen - seplen + 1;- for (var i = 0; i < len; ++i) {- if (Utils.eq(array[i], sepStart)) {- var match = true;- for (var j = seplen; --j; ) {- if (!Utils.eq(array[i+j], sep[j])) { match = false; break; }- }- if (match) {- matches.push(i);- i += seplen - 1;- }- }- }-- // shortcut in case of no matches- if (matches.length === 0) {- return Cons(list,Nil);- }-- var out = Nil;- var index = alen - 1;- for (var i = matches.length; i--; ) {- var temp = Nil;- var stop = matches[i] + seplen - 1;- for ( ; index > stop; --index ) {- temp = Cons(array[index], temp);- }- out = Cons(temp,out);- index -= seplen;- }- return out;- }-- Elm.Native.List.values = {- Nil:Nil,- Cons:Cons,- cons:F2(Cons),- toArray:toArray,- fromArray:fromArray,- range:range,- append:append,-- head:head,- tail:tail,- last:last,-- map:F2(map),- foldl:F3(foldl),- foldr:F3(foldr),-- foldl1:F2(foldl1),- foldr1:F2(foldr1),- scanl:F3(scanl),- scanl1:F2(scanl1),- filter:F2(filter),- length:length,- member:F2(member),- reverse:reverse,- concat:concat,-- all:F2(all),- any:F2(any),- zipWith:F3(zipWith),- zip:F2(zip),- sort:sort,- nth:F2(nth),- take:F2(take),- drop:F2(drop),-- join:F2(join),- split:F2(split)- };- return elm.Native.List = Elm.Native.List.values;--};-Elm.Native.Matrix2D = function(elm) {- "use strict";-- elm.Native = elm.Native || {};- if (elm.Native.Matrix2D) return elm.Native.Matrix2D;-- var A;- if (typeof Float32Array === 'undefined') {- A = function(arr) {- this.length = arr.length;- this[0] = arr[0];- this[1] = arr[1];- this[2] = arr[2];- this[3] = arr[3];- this[4] = arr[4];- this[5] = arr[5];- };- } else {- A = Float32Array;- }-- // layout of matrix in an array is- //- // | m11 m12 dx |- // | m21 m22 dy |- // | 0 0 1 |- //- // new A([ m11, m12, dx, m21, m22, dy ])-- var identity = new A([1,0,0,0,1,0]);- function matrix(m11, m12, m21, m22, dx, dy) {- return new A([m11, m12, dx, m21, m22, dy]);- }- function rotation(t) {- var c = Math.cos(t);- var s = Math.sin(t);- return new A([c, -s, 0, s, c, 0]);- }-- function rotate(t,m) {- var c = Math.cos(t);- var s = Math.sin(t);- var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4];- return new A([m11*c + m12*s, -m11*s + m12*c, m[2],- m21*c + m22*s, -m21*s + m22*c, m[5]]);- }- /*- function move(xy,m) {- var x = xy._0;- var y = xy._1;- var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4];- return new A([m11, m12, m11*x + m12*y + m[2],- m21, m22, m21*x + m22*y + m[5]]);- }- function scale(s,m) { return new A([m[0]*s, m[1]*s, m[2], m[3]*s, m[4]*s, m[5]]); }- function scaleX(x,m) { return new A([m[0]*x, m[1], m[2], m[3]*x, m[4], m[5]]); }- function scaleY(y,m) { return new A([m[0], m[1]*y, m[2], m[3], m[4]*y, m[5]]); }- function reflectX(m) { return new A([-m[0], m[1], m[2], -m[3], m[4], m[5]]); }- function reflectY(m) { return new A([m[0], -m[1], m[2], m[3], -m[4], m[5]]); }-- function transform(m11, m21, m12, m22, mdx, mdy, n) {- var n11 = n[0], n12 = n[1], n21 = n[3], n22 = n[4], ndx = n[2], ndy = n[5];- return new A([m11*n11 + m12*n21,- m11*n12 + m12*n22,- m11*ndx + m12*ndy + mdx,- m21*n11 + m22*n21,- m21*n12 + m22*n22,- m21*ndx + m22*ndy + mdy]);- }- */- function multiply(m, n) {- var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4], mdx = m[2], mdy = m[5];- var n11 = n[0], n12 = n[1], n21 = n[3], n22 = n[4], ndx = n[2], ndy = n[5];- return new A([m11*n11 + m12*n21,- m11*n12 + m12*n22,- m11*ndx + m12*ndy + mdx,- m21*n11 + m22*n21,- m21*n12 + m22*n22,- m21*ndx + m22*ndy + mdy]);- }-- return elm.Native.Matrix2D = {- identity:identity,- matrix:F6(matrix),- rotation:rotation,- multiply:F2(multiply)- /*- transform:F7(transform),- rotate:F2(rotate),- move:F2(move),- scale:F2(scale),- scaleX:F2(scaleX),- scaleY:F2(scaleY),- reflectX:reflectX,- reflectY:reflectY- */- };--};--Elm.Native.Prelude = function(elm) {- 'use strict';- if (elm.Native.Prelude) return elm.Native.Prelude;-- var JS = Elm.Native.JavaScript(elm);- var Maybe = Elm.Maybe(elm);- var Char = Elm.Char(elm);-- function readInt(str) {- var s = JS.fromString(str);- var len = s.length;- if (len === 0) { return Maybe.Nothing; }- var start = 0;- if (s[0] == '-') {- if (len === 1) { return Maybe.Nothing; }- start = 1;- }- for (var i = start; i < len; ++i) {- if (!Char.isDigit(s[i])) { return Maybe.Nothing; }- }- return Maybe.Just(parseInt(s, 10));- }-- function readFloat(str) {- var s = JS.fromString(str);- var len = s.length;- if (len === 0) { return Maybe.Nothing; }- var start = 0;- if (s[0] == '-') {- if (len === 1) { return Maybe.Nothing; }- start = 1;- }- var dotCount = 0;- for (var i = start; i < len; ++i) {- if (Char.isDigit(s[i])) { continue; }- if (s[i] === '.') {- dotCount += 1;- if (dotCount <= 1) { continue; }- }- return Maybe.Nothing;- }- return Maybe.Just(parseFloat(s));- }-- return elm.Native.Prelude = {- readInt:readInt,- readFloat:readFloat,- };--};--Elm.Native.Show = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Show) return elm.Native.Show;-- var NList = Elm.Native.List(elm);- var List = Elm.List(elm);- var Maybe = Elm.Maybe(elm);- var JS = Elm.JavaScript(elm);- var Dict = Elm.Dict(elm);- var Json = Elm.Json(elm);- var Tuple2 = Elm.Native.Utils(elm).Tuple2;-- var toString = function(v) {- if (typeof v === "function") {- var name = v.func ? v.func.name : v.name;- return '<function' + (name === '' ? '' : ': ') + name + '>';- } else if (typeof v === "boolean") {- return v ? "True" : "False";- } else if (typeof v === "number") {- return v+"";- } else if (typeof v === "string" && v.length < 2) {- return "'" + showChar(v) + "'";- } else if (typeof v === "object" && '_' in v) {- var output = [];- for (var k in v._) {- for (var i = v._[k].length; i--; ) {- output.push(k + " = " + toString(v._[k][i]));- }- }- for (var k in v) {- if (k === '_') continue;- output.push(k + " = " + toString(v[k]));- }- if (output.length === 0) return "{}";- return "{ " + output.join(", ") + " }";- } else if (typeof v === "object" && 'ctor' in v) {- if (v.ctor.substring(0,6) === "_Tuple") {- var output = [];- for (var k in v) {- if (k === 'ctor') continue;- output.push(toString(v[k]));- }- return "(" + output.join(",") + ")";- } else if (v.ctor === "::") {- var isStr = typeof v._0 === "string",- start = isStr ? '"' : "[",- end = isStr ? '"' : "]",- sep = isStr ? "" : ",",- f = !isStr ? toString : showChar;- var output = start + f(v._0);- v = v._1;- while (v.ctor === "::") {- output += sep + f(v._0);- v = v._1;- }- return output + end;- } else if (v.ctor === "[]") {- return "[]";- } else if (v.ctor === "RBNode" || v.ctor === "RBEmpty") {- var cons = F3(function(k,v,acc){return NList.Cons(Tuple2(k,v),acc)});- var list = A3(Dict.foldr, cons, NList.Nil, v);- var name = "Dict";- if (list.ctor === "::" && list._0._1.ctor === "_Tuple0") {- name = "Set";- list = A2(List.map, function(x){return x._0}, list);- }- return name + ".fromList " + toString(list);- } else {- var output = "";- for (var i in v) {- if (i === 'ctor') continue;- var str = toString(v[i]);- var parenless = str[0] === '{' || str[0] === '<' || str.indexOf(' ') < 0;- output += ' ' + (parenless ? str : '(' + str + ')');- }- return v.ctor + output;- }- }- if (typeof v === 'object' && 'recv' in v) return '<signal>';- return "<internal structure>";- };- function show(v) { return NList.fromArray(toString(v)); }-- function showChar (c) {- return c === '\n' ? '\\n' :- c === '\t' ? '\\t' :- c === '\b' ? '\\b' :- c === '\r' ? '\\r' :- c === '\v' ? '\\v' :- c === '\0' ? '\\0' :- c === '\'' ? "\\'" :- c === '\"' ? '\\"' :- c === '\\' ? '\\\\' : c;- }-- return elm.Native.Show = { show:show };-};--Elm.Native.Text = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Text) return elm.Native.Text;-- var JS = Elm.JavaScript(elm);- var htmlHeight = Elm.Native.Utils(elm).htmlHeight;- var Color = Elm.Native.Color(elm);- var Element = Elm.Graphics.Element(elm);- var show = Elm.Native.Show(elm).show;-- function makeSpaces(s) {- if (s.length == 0) { return s; }- var arr = s.split('');- if (arr[0] == ' ') { arr[0] = " " } - for (var i = arr.length; --i; ) {- if (arr[i][0] == ' ' && arr[i-1] == ' ') {- arr[i-1] = arr[i-1] + arr[i];- arr[i] = '';- }- }- for (var i = arr.length; i--; ) {- if (arr[i].length > 1 && arr[i][0] == ' ') {- var spaces = arr[i].split('');- for (var j = spaces.length - 2; j >= 0; j -= 2) {- spaces[j] = ' ';- }- arr[i] = spaces.join('');- }- }- arr = arr.join('');- if (arr[arr.length-1] === " ") {- return arr.slice(0,-1) + ' ';- }- return arr;- }-- function properEscape(str) {- if (str.length == 0) return str;- str = str //.replace(/&/g, "&")- .replace(/"/g, /*"*/ '"')- .replace(/'/g, /*'*/ "'")- .replace(/</g, "<")- .replace(/>/g, ">")- .replace(/\n/g, "<br/>");- var arr = str.split('<br/>');- for (var i = arr.length; i--; ) {- arr[i] = makeSpaces(arr[i]);- }- return arr.join('<br/>');- }-- function toText(str) { return properEscape(JS.fromString(str)); }-- function addTag(tag) { return function(text) {- return '<' + tag + ' style="padding:0;margin:0">' + text + '</' + tag + '>';- }- }- - function addStyle(style, value, text) {- return "<span style='" + style + ":" + value + "'>" + text + "</span>";- }-- function typeface(name, text) {- return addStyle('font-family', JS.fromString(name), text);- }- function monospace(text) {- return addStyle('font-family', 'monospace', text);- }- function size(px, text) { return addStyle('font-size', px + 'px', text) }- var header = addTag('h1');- function height(h, text) { return addStyle('font-size', h+'px', text) }- function italic(text) { return addStyle('font-style', 'italic', text) }- var bold = addTag('b');-- function extract(c) {- if (c._3 === 1) { return 'rgb(' + c._0 + ',' + c._1 + ',' + c._2 + ')'; }- return 'rgba(' + c._0 + ',' + c._1 + ',' + c._2 + ',' + c._3 + ')';- }- function color(c, text) {- return addStyle('color', extract(c), text);- }- function underline(text) { return addStyle('text-decoration', 'underline', text) }- function overline(text) { return addStyle('text-decoration', 'overline', text) }- function strikeThrough(text) {- return addStyle('text-decoration', 'line-through', text);- }- function link(href, text) {- return "<a href='" + toText(href) + "'>" + text + "</a>";- }-- function position(pos) { return function(text) {- var e = {ctor:'RawHtml',- _0: '<div style="padding:0;margin:0;text-align:' +- pos + '">' + text + '</div>'- };- var p = A2(htmlHeight, 0, text);- return A3(Element.newElement, p._0, p._1, e);- }- }-- function asText(v) {- return position('left')(monospace(toText(show(v))));- }-- function plainText(v) {- return position('left')(toText(v));- }-- return elm.Native.Text = {- toText: toText,-- header : header,- height : F2(height),- italic : italic,- bold : bold,- underline : underline,- overline : overline,- strikeThrough : strikeThrough,- monospace : monospace,- typeface : F2(typeface),- color : F2(color),- link : F2(link),-- justified : position('justify'),- centered : position('center'),- righted : position('right'),- text : position('left'),- plainText : plainText,-- asText : asText- };--};-Elm.Native.Utils = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Utils) return elm.Native.Utils;-- function eq(x,y) {- if (x === y) return true;- if (typeof x === "object") {- var c = 0;- for (var i in x) { ++c; if (!eq(x[i],y[i])) return false; }- return c === Object.keys(y).length;- }- if (typeof x === 'function') {- throw new Error('Equality error: general function equality is ' +- 'undecidable, and therefore, unsupported');- }- return x === y;- }-- // code in Generate/JavaScript.hs depends on the particular- // integer values assigned to LT, EQ, and GT- var LT = -1, EQ = 0, GT = 1, ord = ['LT','EQ','GT'];- function compare(x,y) { return { ctor: ord[cmp(x,y)+1] } }- function cmp(x,y) {- var ord;- if (typeof x !== 'object') return x === y ? EQ : x < y ? LT : GT;-- if (x.ctor === "::" || x.ctor === "[]") {- while (true) {- if (x.ctor === "[]" && y.ctor === "[]") return EQ;- if (x.ctor !== y.ctor) return x.ctor === '[]' ? LT : GT;- ord = cmp(x._0, y._0);- if (ord !== EQ) return ord;- x = x._1;- y = y._1;- }- }-- if (x.ctor.slice(0,6) === '_Tuple') {- var n = x.ctor.slice(6) - 0;- var err = 'cannot compare tuples with more than 6 elements.';- if (n === 0) return EQ;- if (n >= 1) { ord = cmp(x._0, y._0); if (ord !== EQ) return ord;- if (n >= 2) { ord = cmp(x._1, y._1); if (ord !== EQ) return ord;- if (n >= 3) { ord = cmp(x._2, y._2); if (ord !== EQ) return ord;- if (n >= 4) { ord = cmp(x._3, y._3); if (ord !== EQ) return ord;- if (n >= 5) { ord = cmp(x._4, y._4); if (ord !== EQ) return ord;- if (n >= 6) { ord = cmp(x._5, y._5); if (ord !== EQ) return ord;- if (n >= 7) throw new Error('Comparison error: ' + err); } } } } } }- return EQ;- }- throw new Error('Comparison error: comparison is only defined on ints, ' +- 'floats, times, chars, strings, lists of comparable values, ' +- 'and tuples of comparable values.')- }--- var Tuple0 = { ctor: "_Tuple0" };- function Tuple2(x,y) { return { ctor:"_Tuple2", _0:x, _1:y } }-- var count = 0;- function guid(_) { return count++ }-- function copy(r) {- var o = {};- for (var i in r) { o[i] = r[i]; }- return o;- }-- function remove(x,r) {- var o = copy(r);- if (x in o._) {- o[x] = o._[x][0];- o._[x] = o._[x].slice(1);- if (o._[x].length === 0) { delete o._[x]; }- } else {- delete o[x];- }- return o;- }-- function replace(kvs,r) {- var o = copy(r);- for (var i = kvs.length; i--; ) {- var kvsi = kvs[i];- o[kvsi[0]] = kvsi[1];- }- return o;- }-- function insert(x,v,r) {- var o = copy(r);- if (x in o) o._[x] = [o[x]].concat(x in o._ ? o._[x].slice(0) : []);- o[x] = v;- return o;- }-- function max(a,b) { return a > b ? a : b }- function min(a,b) { return a < b ? a : b }-- function mod(a,b) {- var r = a % b;- var m = a === 0 ? 0 : (b > 0 ? (a >= 0 ? r : r+b) : -mod(-a,-b));-- return m === b ? 0 : m;- }-- function htmlHeight(width, html) {- var t = document.createElement('div');- t.innerHTML = html;- if (width > 0) { t.style.width = width + "px"; }- t.style.visibility = "hidden";- t.style.styleFloat = "left";- t.style.cssFloat = "left";-- elm.node.appendChild(t);- var style = window.getComputedStyle(t, null);- var w = Math.ceil(style.getPropertyValue("width").slice(0,-2) - 0);- var h = Math.ceil(style.getPropertyValue("height").slice(0,-2) - 0);- elm.node.removeChild(t);- return Tuple2(w,h);- }-- function adjustOffset() {- var node = elm.node;- var offsetX = 0, offsetY = 0;- if (node.offsetParent) {- do {- offsetX += node.offsetLeft;- offsetY += node.offsetTop;- } while (node = node.offsetParent);- }- elm.node.offsetX = offsetX;- elm.node.offsetY = offsetY;- }-- if (elm.display === ElmRuntime.Display.COMPONENT) {- elm.addListener(elm.inputs, elm.node, 'mouseover', adjustOffset);- }-- return elm.Native.Utils = {- eq:eq,- cmp:cmp,- compare:F2(compare),- Tuple0:Tuple0,- Tuple2:Tuple2,- copy: copy,- remove: remove,- replace: replace,- insert: insert,- guid: guid,- max : F2(max),- min : F2(min),- mod : F2(mod),- htmlHeight: F2(htmlHeight),- toFloat: function(x){return x}- };-};--Elm.Native.Graphics.Collage = function(elm) {- "use strict";-- elm.Native = elm.Native || {};- elm.Native.Graphics = elm.Native.Graphics || {};- if (elm.Native.Graphics.Collage) return elm.Native.Graphics.Collage;-- var newElement = Elm.Graphics.Element(elm).newElement;- var C = ElmRuntime.use(ElmRuntime.Render.Collage);-- function collage(w,h,forms) {- return A3(newElement, w, h, {- ctor: 'Custom',- type: 'Collage',- render: C.render,- update: C.update,- model: {w:w, h:h, forms:forms}- });- }- return elm.Native.Graphics.Collage = { collage:F3(collage) };--};-Elm.Native.Graphics.Input = function(elm) {- "use strict";-- elm.Native = elm.Native || {};- elm.Native.Graphics = elm.Native.Graphics || {};- if (elm.Native.Graphics.Input) return elm.Native.Graphics.Input;-- var Render = ElmRuntime.use(ElmRuntime.Render.Element);- var newNode = ElmRuntime.use(ElmRuntime.Render.Utils).newElement;-- var Signal = Elm.Signal(elm);- var newElement = Elm.Graphics.Element(elm).newElement;- var JS = Elm.Native.JavaScript(elm);- var Utils = Elm.Native.Utils(elm);- var Tuple2 = Utils.Tuple2;-- function dropDown(values) {- var entries = JS.fromList(values);- var events = Signal.constant(entries[0]._1);-- var drop = newNode('select');- drop.style.border = '0 solid';- for (var i = 0; i < entries.length; ++i) {- var option = newNode('option');- var name = JS.fromString(entries[i]._0);- option.value = name;- option.innerHTML = name;- drop.appendChild(option);- }- drop.addEventListener('change', function() {- elm.notify(events.id, entries[drop.selectedIndex]._1);- });-- var t = drop.cloneNode(true);- t.style.visibility = "hidden";-- elm.node.appendChild(t);- var style = window.getComputedStyle(t, null);- var w = Math.ceil(style.getPropertyValue("width").slice(0,-2) - 0);- var h = Math.ceil(style.getPropertyValue("height").slice(0,-2) - 0);- elm.node.removeChild(t);- - console.log(w,h);- var element = A3(newElement, w, h, {- ctor: 'Custom',- type: 'DropDown',- render: function render(model) { return drop; },- update: function update(node, oldModel, newModel) {},- model: {}- });-- return Tuple2(Signal.constant(element), events);- }-- function buttons(defaultValue) {- var events = Signal.constant(defaultValue);-- function render(model) {- var b = newNode('button');- b.style.display = 'block';- b.elmEvent = model.event;- function click() { elm.notify(events.id, b.elmEvent); }- b.addEventListener('click', click);- b.innerHTML = model.text;- return b;- }-- function update(node, oldModel, newModel) {- node.elmEvent = newModel.event;- var txt = newModel.text;- if (oldModel.text !== txt) node.innerHTML = txt;- }-- function button(evnt, txt) {- return A3(newElement, 100, 40, {- ctor: 'Custom',- type: 'Button',- render: render,- update: update,- model: { event:evnt, text:JS.fromString(txt) }- });- }-- return { _:{}, button:F2(button), events:events };- }-- function customButtons(defaultValue) {- var events = Signal.constant(defaultValue);-- function render(model) {- var btn = newNode('div');- btn.elmEvent = model.event;-- btn.elmUp = Render.render(model.up);- btn.elmHover = Render.render(model.hover);- btn.elmDown = Render.render(model.down);-- function replace(node) {- if (node !== btn.firstChild) btn.replaceChild(node, btn.firstChild);- }- var overCount = 0;- function over(e) {- if (overCount++ > 0) return;- replace(btn.elmHover);- }- function out(e) {- if (btn.contains(e.toElement || e.relatedTarget)) return;- overCount = 0;- replace(btn.elmUp);- }- function up() {- replace(btn.elmHover);- elm.notify(events.id, btn.elmEvent);- }- function down() { replace(btn.elmDown); }- btn.addEventListener('mouseover', over);- btn.addEventListener('mouseout' , out);- btn.addEventListener('mousedown', down);- btn.addEventListener('mouseup' , up);-- btn.appendChild(btn.elmUp);-- var clicker = newNode('div');- clicker.style.width = btn.elmUp.style.width;- clicker.style.height = btn.elmUp.style.height;- clicker.style.position = 'absolute';- clicker.style.top = 0;- btn.appendChild(clicker);-- return btn;- }-- function update(node, oldModel, newModel) {- node.elmEvent = newModel.event;- Render.update(node.elmUp, oldModel.up, newModel.up)- Render.update(node.elmHover, oldModel.hover, newModel.hover)- Render.update(node.elmDown, oldModel.down, newModel.down)- }-- function button(evnt, up, hover, down) {- return A3(newElement,- Math.max(up.props.width, hover.props.width, down.props.width),- Math.max(up.props.height, hover.props.height, down.props.height),- { ctor: 'Custom',- type: 'CustomButton',- render: render,- update: update,- model: { event:evnt, up:up, hover:hover, down:down }- });- }-- return { _:{}, customButton:F4(button), events:events };- }--- function hoverables(defaultValue) {- var events = Signal.constant(defaultValue);- function hoverable(handler, elem) {- function onHover(bool) {- elm.notify(events.id, handler(bool));- }- var props = Utils.replace([['hover',onHover]], elem.props);- return { props:props, element:elem.element };- }- return { _:{}, hoverable:F2(hoverable), events:events };- }--- function checkboxes(defaultValue) {- var events = Signal.constant(defaultValue);-- function render(model) {- var b = newNode('input');- b.type = 'checkbox';- b.checked = model.checked;- b.style.display = 'block';- b.elmHandler = model.handler;- function change() { elm.notify(events.id, b.elmHandler(b.checked)); }- b.addEventListener('change', change);- return b;- }-- function update(node, oldModel, newModel) {- node.elmHandler = newModel.handler;- node.checked = newModel.checked;- return true;- }-- function box(handler, checked) {- return A3(newElement, 13, 13, {- ctor: 'Custom',- type: 'CheckBox',- render: render,- update: update,- model: { checked:checked, handler:handler }- });- }-- return { _:{}, checkbox:F2(box), events:events };- }-- function setRange(node, start, end, dir) {- if (node.parentNode) {- node.setSelectionRange(start, end, dir);- } else {- setTimeout(function(){node.setSelectionRange(start, end, dir);}, 0);- }- }-- function mkTextPool(type) { return function fields(defaultValue) {- var events = Signal.constant(defaultValue);-- var state = null;-- function render(model) {- var field = newNode('input');- field.elmHandler = model.handler;-- field.id = 'test';- field.type = type;- field.placeholder = JS.fromString(model.placeHolder);- field.value = JS.fromString(model.state.string);- setRange(field, model.state.selectionStart, model.state.selectionEnd, 'forward');- field.style.border = 'none';- state = model.state;-- function update() {- var start = field.selectionStart,- end = field.selectionEnd;- if (field.selectionDirection === 'backward') {- start = end;- end = field.selectionStart;- }- state = { _:{},- string:JS.toString(field.value),- selectionStart:start,- selectionEnd:end };- elm.notify(events.id, field.elmHandler(state));- }- function mousedown() {- update();- elm.node.addEventListener('mouseup', mouseup);- }- function mouseup() {- update();- elm.node.removeEventListener('mouseup', mouseup)- }- field.addEventListener('keyup', update);- field.addEventListener('mousedown', mousedown);-- return field;- }-- function update(node, oldModel, newModel) {- node.elmHandler = newModel.handler;- if (state === newModel.state) return;- var newStr = JS.fromString(newModel.state.string);- if (node.value !== newStr) node.value = newStr;-- var start = newModel.state.selectionStart;- var end = newModel.state.selectionEnd;- var direction = 'forward';- if (end < start) {- start = end;- end = newModel.state.selectionStart;- direction = 'backward';- }- - if (node.selectionStart !== start- || node.selectionEnd !== end- || node.selectionDirection !== direction) {- setRange(node, start, end, direction);- }- }-- function field(handler, placeHolder, state) {- return A3(newElement, 200, 30,- { ctor: 'Custom',- type: type + 'Input',- render: render,- update: update,- model: { handler:handler,- placeHolder:placeHolder,- state:state }- });- }-- return { _:{}, field:F3(field), events:events };- }- }-- return elm.Native.Graphics.Input = {- buttons:buttons,- customButtons:customButtons,- hoverables:hoverables,- checkboxes:checkboxes,- fields:mkTextPool('text'),- emails:mkTextPool('email'),- passwords:mkTextPool('password'),- dropDown:dropDown- };--};--Elm.Native.Http = function(elm) {- 'use strict';- elm.Native = elm.Native || {};- if (elm.Native.Http) return elm.Native.Http;--- var JS = Elm.JavaScript(elm);- var List = Elm.List(elm);- var Signal = Elm.Signal(elm);--- function registerReq(queue,responses) { return function(req) {- if (req.url.ctor !== '[]') { sendReq(queue,responses,req); }- };- }-- function updateQueue(queue,responses) {- if (queue.length > 0) {- elm.notify(responses.id, queue[0].value);- if (queue[0].value.ctor !== 'Waiting') {- queue.shift();- setTimeout(function() { updateQueue(queue,responses); }, 0);- }- }- }-- function setHeader(pair) {- request.setRequestHeader( JS.fromString(pair._0), JS.fromString(pair._1) );- }-- function sendReq(queue,responses,req) {- var response = { value: { ctor:'Waiting' } };- queue.push(response);-- var request = null;- if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); }- if (window.XMLHttpRequest) { request = new XMLHttpRequest(); }- request.onreadystatechange = function(e) {- if (request.readyState === 4) {- response.value = (request.status >= 200 && request.status < 300 ?- { ctor:'Success', _0:JS.toString(request.responseText) } :- { ctor:'Failure', _0:request.status, _1:JS.toString(request.statusText) });- setTimeout(function() { updateQueue(queue,responses); }, 0);- }- };- request.open(JS.fromString(req.verb), JS.fromString(req.url), true);- List.map(setHeader)(req.headers);- request.send(JS.fromString(req.body));- }-- function send(requests) {- var responses = Signal.constant(elm.Http.Waiting);- var sender = A2( Signal.lift, registerReq([],responses), requests );- function f(x) { return function(y) { return x; } }- return A3( Signal.lift2, f, responses, sender );- }-- return elm.Native.Http = {send:send};--};--Elm.Native.Keyboard = function(elm) {- 'use strict';- elm.Native = elm.Native || {};- if (elm.Native.Keyboard) return elm.Native.Keyboard;-- var Signal = Elm.Signal(elm);- var NList = Elm.Native.List(elm);-- var keysDown = Signal.constant(NList.Nil);- var lastKey = Signal.constant('\0');-- elm.addListener([keysDown.id], document, 'keydown', function down(e) {- if (NList.member(e.keyCode)(keysDown.value)) return;- elm.notify(keysDown.id, NList.Cons(e.keyCode, keysDown.value));- });- elm.addListener([keysDown.id], document, 'keyup', function up(e) {- function notEq(kc) { return kc !== e.keyCode; }- elm.notify(keysDown.id, NList.filter(notEq)(keysDown.value));- });- elm.addListener([keysDown.id], document, 'blur', function blur(e) {- elm.notify(keysDown.id, NList.Nil);- });- elm.addListener([lastKey.id], document, 'keypress', function press(e) {- elm.notify(lastKey.id, e.charCode || e.keyCode);- });-- function keySignal(f) {- var signal = Signal.dropRepeats(A2(Signal.lift, f, keysDown));- keysDown.defaultNumberOfKids += 1;- signal.defaultNumberOfKids = 0;- return signal;- }-- function dir(up, down, left, right) {- function f(ks) {- var x = 0, y = 0;- while (ks.ctor === "::") {- switch (ks._0) {- case left : --x; break;- case right: ++x; break;- case up : ++y; break;- case down : --y; break;- }- ks = ks._1;- }- return { _:{}, x:x, y:y };- }- return keySignal(f);- }-- function is(key) { return keySignal(NList.member(key)); }-- return elm.Native.Keyboard = {- isDown:is,- directions:F4(dir),- keysDown:keysDown,- lastPressed:lastKey- };--};--Elm.Native.Mouse = function(elm) {- 'use strict';- elm.Native = elm.Native || {};- if (elm.Native.Mouse) return elm.Native.Mouse;-- var Signal = Elm.Signal(elm);- var Utils = Elm.Native.Utils(elm);-- var position = Signal.constant(Utils.Tuple2(0,0));- position.defaultNumberOfKids = 2;-- // do not move x and y into Elm. By setting their default number- // of kids, it is possible to detatch the mouse listeners if- // they are not needed.- var x = A2( Signal.lift, function(p){return p._0}, position);- x.defaultNumberOfKids = 0;- var y = A2( Signal.lift, function(p){return p._1}, position);- y.defaultNumberOfKids = 0;-- var isDown = Signal.constant(false);- var isClicked = Signal.constant(false);- var clicks = Signal.constant(Utils.Tuple0);-- function getXY(e) {- var posx = 0;- var posy = 0;- if (!e) e = window.event;- if (e.pageX || e.pageY) {- posx = e.pageX;- posy = e.pageY;- } else if (e.clientX || e.clientY) {- posx = e.clientX + document.body.scrollLeft +- document.documentElement.scrollLeft;- posy = e.clientY + document.body.scrollTop +- document.documentElement.scrollTop;- }- return Utils.Tuple2(posx-elm.node.offsetX, posy-elm.node.offsetY);- }-- var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;-- elm.addListener([isClicked.id, clicks.id], node, 'click', function click() {- elm.notify(isClicked.id, true);- elm.notify(clicks.id, Utils.Tuple0);- elm.notify(isClicked.id, false);- });- elm.addListener([isDown.id], node, 'mousedown', function down() {- elm.notify(isDown.id, true);- });- elm.addListener([isDown.id], node, 'mouseup', function up() {- elm.notify(isDown.id, false);- });- elm.addListener([position.id], node, 'mousemove', function move(e) {- elm.notify(position.id, getXY(e));- });-- return elm.Native.Mouse = {- position: position,- x:x,- y:y,- isClicked: isClicked,- isDown: isDown,- clicks: clicks- };-};-Elm.Native.Random = function(elm) {- 'use strict';- elm.Native = elm.Native || {};- if (elm.Native.Random) return elm.Native.Random;-- var Signal = Elm.Signal(elm);-- function range(min, max, signal) {- function f(x) { return Math.floor(Math.random() * (max-min+1)) + min; }- return A2( Signal.lift, f, signal );- }-- function flt(signal) {- function f(x) { return Math.random(); }- return A2( Signal.lift, f, signal );- }-- elm.Native.Random = { range: F3(range) };- elm.Native.Random['float'] = flt;- return elm.Native.Random;--};--Elm.Native.Signal = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Signal) return elm.Native.Signal;-- var Utils = Elm.Native.Utils(elm);- var foldl1 = Elm.List(elm).foldl1;-- function send(node, timestep, changed) {- var kids = node.kids;- for (var i = kids.length; i--; ) {- kids[i].recv(timestep, changed, node.id);- }- }-- function Input(base) {- this.id = Utils.guid();- this.value = base;- this.kids = [];- this.defaultNumberOfKids = 0;- this.recv = function(timestep, eid, v) {- var changed = eid === this.id;- if (changed) { this.value = v; }- send(this, timestep, changed);- return changed;- };- elm.inputs.push(this);- }-- function LiftN(update, args) {- this.id = Utils.guid();- this.value = update();- this.kids = [];-- var n = args.length;- var count = 0;- var isChanged = false;-- this.recv = function(timestep, changed, parentID) {- ++count;- if (changed) { isChanged = true; }- if (count == n) {- if (isChanged) { this.value = update(); }- send(this, timestep, isChanged);- isChanged = false;- count = 0;- }- };- for (var i = n; i--; ) { args[i].kids.push(this); }- }-- function lift(func, a) {- function update() { return func(a.value); }- return new LiftN(update, [a]);- }- function lift2(func, a, b) {- function update() { return A2( func, a.value, b.value ); }- return new LiftN(update, [a,b]);- }- function lift3(func, a, b, c) {- function update() { return A3( func, a.value, b.value, c.value ); }- return new LiftN(update, [a,b,c]);- }- function lift4(func, a, b, c, d) {- function update() { return A4( func, a.value, b.value, c.value, d.value ); }- return new LiftN(update, [a,b,c,d]);- }- function lift5(func, a, b, c, d, e) {- function update() { return A5( func, a.value, b.value, c.value, d.value, e.value ); }- return new LiftN(update, [a,b,c,d,e]);- }- function lift6(func, a, b, c, d, e, f) {- function update() { return A6( func, a.value, b.value, c.value, d.value, e.value, f.value ); }- return new LiftN(update, [a,b,c,d,e,f]);- }- function lift7(func, a, b, c, d, e, f, g) {- function update() { return A7( func, a.value, b.value, c.value, d.value, e.value, f.value, g.value ); }- return new LiftN(update, [a,b,c,d,e,f,g]);- }- function lift8(func, a, b, c, d, e, f, g, h) {- function update() { return A8( func, a.value, b.value, c.value, d.value, e.value, f.value, g.value, h.value ); }- return new LiftN(update, [a,b,c,d,e,f,g,h]);- }-- function Foldp(step, state, input) {- this.id = Utils.guid();- this.value = state;- this.kids = [];-- this.recv = function(timestep, changed, parentID) {- if (changed) {- this.value = A2( step, input.value, this.value );- }- send(this, timestep, changed);- };- input.kids.push(this);- }-- function foldp(step, state, input) {- return new Foldp(step, state, input);- }-- function DropIf(pred,base,input) {- this.id = Utils.guid();- this.value = pred(input.value) ? base : input.value;- this.kids = [];- this.recv = function(timestep, changed, parentID) {- var chng = changed && !pred(input.value);- if (chng) { this.value = input.value; }- send(this, timestep, chng);- };- input.kids.push(this);- }-- function DropRepeats(input) {- this.id = Utils.guid();- this.value = input.value;- this.kids = [];- this.recv = function(timestep, changed, parentID) {- var chng = changed && !Utils.eq(this.value,input.value);- if (chng) { this.value = input.value; }- send(this, timestep, chng);- };- input.kids.push(this);- }-- function dropWhen(s1,b,s2) {- var pairs = lift2( F2(function(x,y){return {x:x,y:y};}), s1, s2 );- var dropped = new DropIf(function(p){return p.x;},{x:true,y:b},pairs);- return lift(function(p){return p.y;}, dropped);- }-- function timestamp(a) {- function update() { return Utils.Tuple2(Date.now(), a.value); }- return new LiftN(update, [a]);- }-- function SampleOn(s1,s2) {- this.id = Utils.guid();- this.value = s2.value;- this.kids = [];-- var count = 0;- var isChanged = false;-- this.recv = function(timestep, changed, parentID) {- if (parentID === s1.id) isChanged = changed;- ++count;- if (count == 2) {- if (isChanged) { this.value = s2.value; }- send(this, timestep, isChanged);- count = 0;- isChanged = false;- }- };- s1.kids.push(this);- s2.kids.push(this);- }-- function sampleOn(s1,s2) { return new SampleOn(s1,s2); }-- function delay(t,s) {- var delayed = new Input(s.value);- var firstEvent = true;- function update(v) {- if (firstEvent) { firstEvent = false; return; }- setTimeout(function() { elm.notify(delayed.id, v); }, t);- }- function first(a,b) { return a; }- return new SampleOn(delayed, lift2(F2(first), delayed, lift(update,s)));- }-- function Merge(s1,s2) {- this.id = Utils.guid();- this.value = s1.value;- this.kids = [];-- var next = null;- var count = 0;- var isChanged = false;-- this.recv = function(timestep, changed, parentID) {- ++count;- if (changed) {- isChanged = true;- if (parentID == s2.id && next === null) { next = s2.value; }- if (parentID == s1.id) { next = s1.value; }- }-- if (count == 2) {- if (isChanged) { this.value = next; next = null; }- send(this, timestep, isChanged);- isChanged = false;- count = 0;- }- };- s1.kids.push(this);- s2.kids.push(this);- }-- function merge(s1,s2) { return new Merge(s1,s2); }- function merges(ss) { return A2(foldl1, F2(merge), ss); }-- return elm.Native.Signal = {- constant : function(v) { return new Input(v); },- lift : F2(lift ),- lift2 : F3(lift2),- lift3 : F4(lift3),- lift4 : F5(lift4),- lift5 : F6(lift5),- lift6 : F7(lift6),- lift7 : F8(lift7),- lift8 : F9(lift8),- foldp : F3(foldp),- delay : F2(delay),- merge : F2(merge),- merges : merges,- count : function(s) { return foldp(F2(function(_,c) { return c+1; }), 0, s); },- countIf : F2(function(pred,s) {- return foldp(F2(function(x,c){- return pred(x) ? c+1 : c; }), 0, s)}),- keepIf : F3(function(pred,base,sig) {- return new DropIf(function(x) {return !pred(x);},base,sig); }),- dropIf : F3(function(pred,base,sig) { return new DropIf(pred,base,sig); }),- keepWhen : F3(function(s1,b,s2) {- return dropWhen(lift(function(b){return !b;},s1), b, s2); }),- dropWhen : F3(dropWhen),- dropRepeats : function(s) { return new DropRepeats(s);},- sampleOn : F2(sampleOn),- timestamp : timestamp- };-};--Elm.Native.Time = function(elm) {- 'use strict';-- var Signal = Elm.Signal(elm);- var NS = Elm.Native.Signal(elm);- var Maybe = Elm.Maybe(elm);- var Utils = Elm.Native.Utils(elm);-- function fpsWhen(desiredFPS, isOn) {- var msPerFrame = 1000 / desiredFPS;- var prev = Date.now(), curr = prev, diff = 0, wasOn = true;- var ticker = Signal.constant(diff);- function tick(zero) { return function() {- curr = Date.now();- diff = zero ? 0 : curr - prev;- prev = curr;- elm.notify(ticker.id, diff);- };- }- var timeoutID = 0;- function f(isOn, t) {- if (isOn) {- timeoutID = setTimeout(tick(!wasOn && isOn), msPerFrame);- } else if (wasOn) {- clearTimeout(timeoutID);- }- wasOn = isOn;- return t;- }- return A3( Signal.lift2, F2(f), isOn, ticker );- }-- function everyWhen(t, isOn) {- var clock = Signal.constant(Date.now());- var id = setInterval(function tellTime() {- if (!elm.notify(clock.id, Date.now())) {- clearInterval(id);- }- }, t);- return clock;- }-- function since(t, s) {- function cmp(a,b) { return !Utils.eq(a,b); }- var dcount = Signal.count(A2(NS.delay, t, s));- return A3( Signal.lift2, F2(cmp), Signal.count(s), dcount );- }- function read(s) {- var t = Date.parse(s);- return isNaN(t) ? Maybe.Nothing : Maybe.Just(t);- }- return elm.Native.Time = {- fpsWhen : F2(fpsWhen),- fps : function(t) { return fpsWhen(t, Signal.constant(true)); },- every : function(t) { return everyWhen(t, Signal.constant(true)) },- delay : NS.delay,- timestamp : NS.timestamp,- since : F2(since),- toDate : function(t) { return new window.Date(t); },- read : read- };--};--Elm.Native.Touch = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Touch) return elm.Native.Touch;-- var Signal = Elm.Signal(elm);- var JS = Elm.JavaScript(elm);- var _ = Elm.Native.Utils(elm);-- function Dict() {- this.keys = [];- this.values = [];-- this.insert = function(key,value) {- this.keys.push(key);- this.values.push(value);- };- this.lookup = function(key) {- var i = this.keys.indexOf(key)- return i >= 0 ? this.values[i] : {x:0,y:0,t:0};- };- this.remove = function(key) {- var i = this.keys.indexOf(key);- if (i < 0) return;- var t = this.values[i];- this.keys.splice(i,1);- this.values.splice(i,1);- return t;- };- this.clear = function() {- this.keys = [];- this.values = [];- };- }- - var root = Signal.constant([]),- tapTime = 500,- hasTap = false,- tap = {_:{},x:0,y:0},- dict = new Dict();-- function touch(t) {- var r = dict.lookup(t.identifier);- return {_ : {},- id: t.identifier,- x : t.pageX - elm.node.offsetX,- y : t.pageY - elm.node.offsetY,- x0: r.x,- y0: r.y,- t0: r.t- };- }-- var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;-- function start(e) {- dict.insert(e.identifier,- {x: e.pageX - elm.node.offsetX,- y: e.pageY - elm.node.offsetY,- t: Date.now()});- }- function end(e) {- var t = dict.remove(e.identifier);- if (Date.now() - t.t < tapTime) {- hasTap = true;- tap = {_:{}, x:t.x, y:t.y};- }- }-- function listen(name, f) {- function update(e) {- for (var i = e.changedTouches.length; i--; ) { f(e.changedTouches[i]); }- var ts = new Array(e.touches.length);- for (var i = e.touches.length; i--; ) { ts[i] = touch(e.touches[i]); }- elm.notify(root.id, ts);- e.preventDefault();- }- elm.addListener([root.id], node, name, update);- }-- listen("touchstart", start);- listen("touchmove", function(_){});- listen("touchend", end);- listen("touchcancel", end);- listen("touchleave", end);-- var mouseID = -1;- function move(e) {- for (var i = root.value.length; i--; ) {- if (root.value[i].id === mouseID) {- root.value[i].x = e.pageX - elm.node.offsetX;- root.value[i].y = e.pageY - elm.node.offsetY;- elm.notify(root.id, root.value);- break;- }- }- }- elm.addListener([root.id], node, "mousedown", function down(e) {- node.addEventListener("mousemove", move);- e.identifier = mouseID;- start(e);- root.value.push(touch(e));- elm.notify(root.id, root.value);- });- elm.addListener([root.id], node, "mouseup", function up(e) {- node.removeEventListener("mousemove", move);- e.identifier = mouseID;- end(e);- for (var i = root.value.length; i--; ) {- if (root.value[i].id === mouseID) {- root.value.splice(i, 1);- --mouseID;- break;- }- }- elm.notify(root.id, root.value);- });- elm.addListener([root.id], node, "blur", function blur(e) {- node.removeEventListener("mousemove", move);- if (root.value.length > 0) {- elm.notify(root.id, []);- --mouseID;- }- dict.clear();- });-- function dependency(f) {- var sig = A2( Signal.lift, f, root );- root.defaultNumberOfKids += 1;- sig.defaultNumberOfKids = 0;- return sig;- }-- var touches = dependency(JS.toList);-- var taps = function() {- var sig = dependency(function(_) { return tap; });- sig.defaultNumberOfKids = 1;- function pred(_) { var b = hasTap; hasTap = false; return b; }- var sig2 = A3( Signal.keepIf, pred, {_:{},x:0,y:0}, sig);- sig2.defaultNumberOfKids = 0;- return sig2;- }();-- return elm.Native.Touch = { touches: touches, taps: taps };--};-Elm.Native.WebSocket = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.WebSocket) return elm.Native.WebSocket;-- var Signal = Elm.Signal(elm);- var JS = Elm.JavaScript(elm);- var List = Elm.Native.List(elm);-- function open(url, outgoing) {- var incoming = Signal.constant(List.Nil);- var ws = new WebSocket(JS.fromString(url));-- var pending = [];- var ready = false;- - ws.onopen = function(e) {- var len = pending.length;- for (var i = 0; i < len; ++i) { ws.send(pending[i]); }- ready = true;- };- ws.onmessage = function(event) {- elm.notify(incoming.id, JS.toString(event.data));- };- - function send(msg) {- var s = JS.fromString(msg);- ready ? ws.send(s) : pending.push(s);- }- - function take1(x,y) { return x }- return A3(Signal.lift2, F2(take1), incoming, A2(Signal.lift, send, outgoing));- }-- return elm.Native.WebSocket = { connect: F2(open) };-};--Elm.Native.Window = function(elm) {- 'use strict';-- elm.Native = elm.Native || {};- if (elm.Native.Window) return elm.Native.Window;-- var Signal = Elm.Signal(elm);- var Tuple2 = Elm.Native.Utils(elm).Tuple2;-- function getWidth() { return elm.node.clientWidth; }- function getHeight() {- if (elm.display === ElmRuntime.Display.FULLSCREEN) {- return window.innerHeight;- }- return elm.node.clientHeight;- }-- var dimensions = Signal.constant(Tuple2(getWidth(), getHeight()));- dimensions.defaultNumberOfKids = 2;-- // Do not move width and height into Elm. By setting the default number of kids,- // the resize listener can be detached.- var width = A2(Signal.lift, function(p){return p._0;}, dimensions);- width.defaultNumberOfKids = 0;-- var height = A2(Signal.lift, function(p){return p._1;}, dimensions);- height.defaultNumberOfKids = 0;-- function resizeIfNeeded() {- var w = getWidth();- var h = getHeight();- if (dimensions.value._0 === w && dimensions.value._1 === h) return;- elm.notify(dimensions.id, Tuple2(w,h));- }- elm.addListener([dimensions.id], window, 'resize', resizeIfNeeded);-- return elm.Native.Window = {- dimensions:dimensions,- width:width,- height:height,- resizeIfNeeded:resizeIfNeeded- };--};--Elm.Automaton = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Automaton';- var Basics = Elm.Basics(elm);- var Signal = Elm.Signal(elm);- var List = Elm.List(elm);- var Maybe = Elm.Maybe(elm);- var _op = {};- var enqueue = F2(function(x, arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- return {ctor:"_Tuple2", _0:_L.Cons(x,arg1._0), _1:arg1._1};- }_E.Case($moduleName,'on line 72, column 22 to 31')}();});- var empty = {ctor:"_Tuple2", _0:_J.toList([]), _1:_J.toList([])};- var dequeue = function(q){- return function(){- switch (q.ctor) {- case '_Tuple2':- switch (q._0.ctor) {- case '[]':- switch (q._1.ctor) {- case '[]':- return Maybe.Nothing;- }break;- }- switch (q._1.ctor) {- case '::':- return Maybe.Just({ctor:"_Tuple2", _0:q._1._0, _1:{ctor:"_Tuple2", _0:q._0, _1:q._1._1}});- case '[]':- return dequeue({ctor:"_Tuple2", _0:_J.toList([]), _1:List.reverse(q._0)});- }break;- }_E.Case($moduleName,'between lines 73 and 76')}();};- var Step = function(a){- return {ctor:"Step", _0:a};};- var hiddenState = F2(function(s, f){- return Step(function(x){- return function(){- var _8 = A2(f, x, s);- var out = function(){- switch (_8.ctor) {- case '_Tuple2':- return _8._1;- }_E.Case($moduleName,'on line 63, column 46 to 51')}();- var s$ = function(){- switch (_8.ctor) {- case '_Tuple2':- return s$;- }_E.Case($moduleName,'on line 63, column 46 to 51')}();- return {ctor:"_Tuple2", _0:A2(hiddenState, s$, f), _1:out};}();});});- var average = function(k){- return function(){- var stepFull = F2(function(n, arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple3':- return function(){- var case19 = dequeue(arg1._0);- switch (case19.ctor) {- case 'Just':- switch (case19._0.ctor) {- case '_Tuple2':- return function(){- var sum$ = ((arg1._2+n)-case19._0._0);- return {ctor:"_Tuple2", _0:{ctor:"_Tuple3", _0:A2(enqueue, n, case19._0._1), _1:arg1._1, _2:sum$}, _1:(sum$/Basics.toFloat(arg1._1))};}();- }break;- case 'Nothing':- return {ctor:"_Tuple2", _0:{ctor:"_Tuple3", _0:arg1._0, _1:arg1._1, _2:arg1._2}, _1:0};- }_E.Case($moduleName,'between lines 85 and 89')}();- }_E.Case($moduleName,'between lines 85 and 89')}();});- var step = F2(function(n, arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple3':- return (_N.eq(arg1._1,k) ? A2(stepFull, n, {ctor:"_Tuple3", _0:arg1._0, _1:arg1._1, _2:arg1._2}) : (Basics.otherwise ? {ctor:"_Tuple2", _0:{ctor:"_Tuple3", _0:A2(enqueue, n, arg1._0), _1:(arg1._1+1), _2:(arg1._2+n)}, _1:((arg1._2+n)/(Basics.toFloat(arg1._1)+1))} : _E.If($moduleName,'between lines 82 and 83')));- }_E.Case($moduleName,'between lines 82 and 83')}();});- return A2(hiddenState, {ctor:"_Tuple3", _0:empty, _1:0, _2:0}, step);}();};- var pure = function(f){- return Step(function(x){- return {ctor:"_Tuple2", _0:pure(f), _1:f(x)};});};- var run = F3(function(auto, base, inputs){- return function(){- var step = F2(function(a, arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- switch (arg1._0.ctor) {- case 'Step':- return arg1._0._0(a);- }break;- }_E.Case($moduleName,'on line 18, column 28 to 31')}();});- return A2(Signal.lift, function(arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- return arg1._1;- }_E.Case($moduleName,'on line 19, column 23 to 24')}();}, A3(Signal.foldp, step, {ctor:"_Tuple2", _0:auto, _1:base}, inputs));}();});- var state = F2(function(s, f){- return Step(function(x){- return function(){- var s$ = A2(f, x, s);- return {ctor:"_Tuple2", _0:A2(state, s$, f), _1:s$};}();});});- var count = A2(state, 0, F2(function(arg2, c){- return function(){- return (c+1);}();}));- var step = F2(function(a, arg1){- return function(){- switch (arg1.ctor) {- case 'Step':- return arg1._0(a);- }_E.Case($moduleName,'on line 23, column 19 to 22')}();});- var combine = function(autos){- return Step(function(a){- return function(){- var _37 = List.unzip(A2(List.map, step(a), autos));- var autos$ = function(){- switch (_37.ctor) {- case '_Tuple2':- return autos$;- }_E.Case($moduleName,'on line 39, column 34 to 59')}();- var bs = function(){- switch (_37.ctor) {- case '_Tuple2':- return _37._1;- }_E.Case($moduleName,'on line 39, column 34 to 59')}();- return {ctor:"_Tuple2", _0:combine(autos$), _1:bs};}();});};- _op['>>>'] = F2(function(f, g){- return Step(function(a){- return function(){- var _44 = A2(step, a, f);- var b = function(){- switch (_44.ctor) {- case '_Tuple2':- return _44._1;- }_E.Case($moduleName,'on line 28, column 29 to 37')}();- var f$ = function(){- switch (_44.ctor) {- case '_Tuple2':- return f$;- }_E.Case($moduleName,'on line 28, column 29 to 37')}();- var _51 = A2(step, b, g);- var c = function(){- switch (_51.ctor) {- case '_Tuple2':- return _51._1;- }_E.Case($moduleName,'on line 29, column 29 to 37')}();- var g$ = function(){- switch (_51.ctor) {- case '_Tuple2':- return g$;- }_E.Case($moduleName,'on line 29, column 29 to 37')}();- return {ctor:"_Tuple2", _0:A2(_op['>>>'], f$, g$), _1:c};}();});});- _op['<<<'] = F2(function(g, f){- return A2(_op['>>>'], f, g);});- return elm.Automaton = {- _op : _op, - run : run, - step : step, - combine : combine, - pure : pure, - state : state, - hiddenState : hiddenState, - count : count, - empty : empty, - enqueue : enqueue, - dequeue : dequeue, - average : average, - Step : Step};};-Elm.Basics = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Basics';- var Native = Native || {};- Native.Basics = Elm.Native.Basics(elm);- var _op = {};- _op['||'] = Native.Basics.or;- _op['|>'] = F2(function(x, f){- return f(x);});- var xor = Native.Basics.xor;- var uncurry = Native.Basics.uncurry;- var truncate = Native.Basics.truncate;- var toFloat = Native.Basics.toFloat;- var tan = Native.Basics.tan;- var sqrt = Native.Basics.sqrt;- var snd = Native.Basics.snd;- var sin = Native.Basics.sin;- var round = Native.Basics.round;- var rem = Native.Basics.rem;- var radians = function(t){- return t;};- var pi = Native.Basics.pi;- var otherwise = true;- var not = Native.Basics.not;- var mod = Native.Basics.mod;- var min = Native.Basics.min;- var max = Native.Basics.max;- var logBase = Native.Basics.logBase;- var id = function(x){- return x;};- var fst = Native.Basics.fst;- var floor = Native.Basics.floor;- var flip = F3(function(f, b, a){- return A2(f, a, b);});- var e = Native.Basics.e;- var div = Native.Basics.div;- var curry = Native.Basics.curry;- var cos = Native.Basics.cos;- var compare = Native.Basics.compare;- var clamp = Native.Basics.clamp;- var ceiling = Native.Basics.ceiling;- var atan2 = Native.Basics.atan2;- var atan = Native.Basics.atan;- var asin = Native.Basics.asin;- var acos = Native.Basics.acos;- var abs = Native.Basics.abs;- _op['^'] = Native.Basics.exp;- var LT = {ctor:"LT"};- var GT = {ctor:"GT"};- var EQ = {ctor:"EQ"};- _op['>='] = Native.Basics.ge;- _op['>'] = Native.Basics.gt;- _op['=='] = Native.Basics.eq;- _op['<|'] = F2(function(f, x){- return f(x);});- _op['<='] = Native.Basics.le;- _op['<'] = Native.Basics.lt;- _op['/='] = Native.Basics.neq;- _op['/'] = Native.Basics.floatDiv;- _op['.'] = F3(function(f, g, x){- return f(g(x));});- _op['-'] = Native.Basics.sub;- _op['+'] = Native.Basics.add;- var toPolar = function(arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- return {ctor:"_Tuple2", _0:Native.Basics.sqrt((Math.pow(arg1._0,2)+Math.pow(arg1._1,2))), _1:A2(Native.Basics.atan2, arg1._1, arg1._0)};- }_E.Case($moduleName,'on line 29, column 18 to 73')}();};- _op['*'] = Native.Basics.mul;- var degrees = function(d){- return ((d*Native.Basics.pi)/180);};- var fromPolar = function(arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- return {ctor:"_Tuple2", _0:(arg1._0*Native.Basics.cos(arg1._1)), _1:(arg1._0*Native.Basics.sin(arg1._1))};- }_E.Case($moduleName,'on line 24, column 20 to 68')}();};- var turns = function(r){- return ((2*Native.Basics.pi)*r);};- _op['&&'] = Native.Basics.and;- return elm.Basics = {- _op : _op, - radians : radians, - degrees : degrees, - turns : turns, - fromPolar : fromPolar, - toPolar : toPolar, - div : div, - rem : rem, - mod : mod, - cos : cos, - sin : sin, - tan : tan, - acos : acos, - asin : asin, - atan : atan, - atan2 : atan2, - sqrt : sqrt, - abs : abs, - logBase : logBase, - min : min, - max : max, - clamp : clamp, - pi : pi, - e : e, - compare : compare, - xor : xor, - not : not, - otherwise : otherwise, - round : round, - truncate : truncate, - floor : floor, - ceiling : ceiling, - toFloat : toFloat, - id : id, - fst : fst, - snd : snd, - flip : flip, - curry : curry, - uncurry : uncurry, - LT : LT, - EQ : EQ, - GT : GT};};-Elm.Char = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Char';- var Native = Native || {};- Native.Char = Elm.Native.Char(elm);- var _op = {};- var toUpper = Native.Char.toUpper;- var toLower = Native.Char.toLower;- var toLocaleUpper = Native.Char.toLocaleUpper;- var toLocaleLower = Native.Char.toLocaleLower;- var toCode = Native.Char.toCode;- var isUpper = Native.Char.isUpper;- var isOctDigit = Native.Char.isOctDigit;- var isLower = Native.Char.isLower;- var isHexDigit = Native.Char.isHexDigit;- var isDigit = Native.Char.isDigit;- var fromCode = Native.Char.fromCode;- return elm.Char = {- _op : _op, - isUpper : isUpper, - isLower : isLower, - isDigit : isDigit, - isOctDigit : isOctDigit, - isHexDigit : isHexDigit, - toUpper : toUpper, - toLower : toLower, - toLocaleUpper : toLocaleUpper, - toLocaleLower : toLocaleLower, - toCode : toCode, - fromCode : fromCode};};-Elm.Color = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Color';- var Native = Native || {};- Native.Color = Elm.Native.Color(elm);- var _op = {};- var hsva = Native.Color.hsva;- var hsv = Native.Color.hsv;- var complement = Native.Color.complement;- var Radial = F5(function(a, b, c, d, e){- return {ctor:"Radial", _0:a, _1:b, _2:c, _3:d, _4:e};});- var radial = Radial;- var Linear = F3(function(a, b, c){- return {ctor:"Linear", _0:a, _1:b, _2:c};});- var linear = Linear;- var Color = F4(function(a, b, c, d){- return {ctor:"Color", _0:a, _1:b, _2:c, _3:d};});- var black = A4(Color, 0, 0, 0, 1);- var blue = A4(Color, 0, 0, 255, 1);- var cyan = A4(Color, 0, 255, 255, 1);- var forestGreen = A4(Color, 34, 139, 34, 1);- var gray = A4(Color, 128, 128, 128, 1);- var green = A4(Color, 0, 128, 0, 1);- var grey = A4(Color, 128, 128, 128, 1);- var lime = A4(Color, 0, 255, 0, 1);- var magenta = A4(Color, 255, 0, 255, 1);- var maroon = A4(Color, 128, 0, 0, 1);- var navy = A4(Color, 0, 0, 128, 1);- var purple = A4(Color, 128, 0, 128, 1);- var red = A4(Color, 255, 0, 0, 1);- var rgb = F3(function(r, g, b){- return A4(Color, r, g, b, 1);});- var rgba = Color;- var teal = A4(Color, 0, 128, 128, 1);- var violet = A4(Color, 238, 130, 238, 1);- var white = A4(Color, 255, 255, 255, 1);- var yellow = A4(Color, 255, 255, 0, 1);- return elm.Color = {- _op : _op, - rgba : rgba, - rgb : rgb, - red : red, - lime : lime, - blue : blue, - yellow : yellow, - cyan : cyan, - magenta : magenta, - black : black, - white : white, - gray : gray, - grey : grey, - maroon : maroon, - navy : navy, - green : green, - teal : teal, - purple : purple, - violet : violet, - forestGreen : forestGreen, - complement : complement, - hsva : hsva, - hsv : hsv, - linear : linear, - radial : radial, - Color : Color, - Linear : Linear, - Radial : Radial};};-Elm.Date = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Date';- var Basics = Elm.Basics(elm);- var Native = Native || {};- Native.Date = Elm.Native.Date(elm);- var Time = Elm.Time(elm);- var Maybe = Elm.Maybe(elm);- var _op = {};- var year = Native.Date.year;- var toTime = Native.Date.toTime;- var second = Native.Date.second;- var read = Native.Date.read;- var month = Native.Date.month;- var minute = Native.Date.minute;- var hour = Native.Date.hour;- var dayOfWeek = Native.Date.dayOfWeek;- var day = Native.Date.day;- var Wed = {ctor:"Wed"};- var Tue = {ctor:"Tue"};- var Thu = {ctor:"Thu"};- var Sun = {ctor:"Sun"};- var Sep = {ctor:"Sep"};- var Sat = {ctor:"Sat"};- var Oct = {ctor:"Oct"};- var Nov = {ctor:"Nov"};- var Mon = {ctor:"Mon"};- var May = {ctor:"May"};- var Mar = {ctor:"Mar"};- var Jun = {ctor:"Jun"};- var Jul = {ctor:"Jul"};- var Jan = {ctor:"Jan"};- var Fri = {ctor:"Fri"};- var Feb = {ctor:"Feb"};- var Dec = {ctor:"Dec"};- var Date = {ctor:"Date"};- var Aug = {ctor:"Aug"};- var Apr = {ctor:"Apr"};- return elm.Date = {- _op : _op, - read : read, - toTime : toTime, - year : year, - month : month, - day : day, - dayOfWeek : dayOfWeek, - hour : hour, - minute : minute, - second : second, - Date : Date, - Mon : Mon, - Tue : Tue, - Wed : Wed, - Thu : Thu, - Fri : Fri, - Sat : Sat, - Sun : Sun, - Jan : Jan, - Feb : Feb, - Mar : Mar, - Apr : Apr, - May : May, - Jun : Jun, - Jul : Jul, - Aug : Aug, - Sep : Sep, - Oct : Oct, - Nov : Nov, - Dec : Dec};};-Elm.Dict = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Dict';- var Basics = Elm.Basics(elm);- var Maybe = Elm.Maybe(elm);- var Native = Native || {};- Native.Error = Elm.Native.Error(elm);- var List = Elm.List(elm);- var Native = Native || {};- Native.Utils = Elm.Native.Utils(elm);- var _op = {};- var Red = {ctor:"Red"};- var RBNode = F5(function(a, b, c, d, e){- return {ctor:"RBNode", _0:a, _1:b, _2:c, _3:d, _4:e};});- var isRed = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._0.ctor) {- case 'Red':- return true;- }break;- }- return false;}();};- var isRedLeft = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- switch (t._3._0.ctor) {- case 'Red':- return true;- }break;- }break;- }- return false;}();};- var isRedLeftLeft = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- switch (t._3._3.ctor) {- case 'RBNode':- switch (t._3._3._0.ctor) {- case 'Red':- return true;- }break;- }break;- }break;- }- return false;}();};- var isRedRight = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBNode':- switch (t._4._0.ctor) {- case 'Red':- return true;- }break;- }break;- }- return false;}();};- var isRedRightLeft = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBNode':- switch (t._4._3.ctor) {- case 'RBNode':- switch (t._4._3._0.ctor) {- case 'Red':- return true;- }break;- }break;- }break;- }- return false;}();};- var rotateLeft = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBNode':- return A5(RBNode, t._0, t._4._1, t._4._2, A5(RBNode, Red, t._1, t._2, t._3, t._4._3), t._4._4);- }break;- }- return Native.Error.raise(_str('rotateLeft of a node without enough children'));}();};- var rotateLeftIfNeeded = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBNode':- switch (t._4._0.ctor) {- case 'Red':- return rotateLeft(t);- }break;- }break;- }- return t;}();};- var rotateRight = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- return A5(RBNode, t._0, t._3._1, t._3._2, t._3._3, A5(RBNode, Red, t._1, t._2, t._3._4, t._4));- }break;- }- return Native.Error.raise(_str('rotateRight of a node without enough children'));}();};- var rotateRightIfNeeded = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- switch (t._3._0.ctor) {- case 'Red':- switch (t._3._3.ctor) {- case 'RBNode':- switch (t._3._3._0.ctor) {- case 'Red':- return rotateRight(t);- }break;- }break;- }break;- }break;- }- return t;}();};- var RBEmpty = {ctor:"RBEmpty"};- var empty = RBEmpty;- var findWithDefault = F3(function(base, k, t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return base;- case 'RBNode':- return function(){- var case115 = A2(Native.Utils.compare, k, t._1);- switch (case115.ctor) {- case 'EQ':- return t._2;- case 'GT':- return A3(findWithDefault, base, k, t._4);- case 'LT':- return A3(findWithDefault, base, k, t._3);- }_E.Case($moduleName,'between lines 137 and 153')}();- }_E.Case($moduleName,'between lines 134 and 153')}();});- var foldl = F3(function(f, acc, t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return acc;- case 'RBNode':- return A3(foldl, f, A3(f, t._1, t._2, A3(foldl, f, acc, t._3)), t._4);- }_E.Case($moduleName,'between lines 360 and 362')}();});- var foldr = F3(function(f, acc, t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return acc;- case 'RBNode':- return A3(foldr, f, A3(f, t._1, t._2, A3(foldr, f, acc, t._4)), t._3);- }_E.Case($moduleName,'between lines 368 and 370')}();});- var keys = function(t){- return A3(foldr, F3(function(k, v, acc){- return _L.Cons(k,acc);}), _J.toList([]), t);};- var toList = function(t){- return A3(foldr, F3(function(k, v, acc){- return _L.Cons({ctor:"_Tuple2", _0:k, _1:v},acc);}), _J.toList([]), t);};- var values = function(t){- return A3(foldr, F3(function(k, v, acc){- return _L.Cons(v,acc);}), _J.toList([]), t);};- var lookup = F2(function(k, t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return Maybe.Nothing;- case 'RBNode':- return function(){- var case134 = A2(Native.Utils.compare, k, t._1);- switch (case134.ctor) {- case 'EQ':- return Maybe.Just(t._2);- case 'GT':- return A2(lookup, k, t._4);- case 'LT':- return A2(lookup, k, t._3);- }_E.Case($moduleName,'between lines 125 and 128')}();- }_E.Case($moduleName,'between lines 122 and 128')}();});- var member = F2(function(k, t){- return Maybe.isJust(A2(lookup, k, t));});- var map = F2(function(f, t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return RBEmpty;- case 'RBNode':- return A5(RBNode, t._0, t._1, f(t._2), A2(map, f, t._3), A2(map, f, t._4));- }_E.Case($moduleName,'between lines 352 and 354')}();});- var min = function(t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return Native.Error.raise(_str('(min Empty) is not defined'));- case 'RBNode':- switch (t._3.ctor) {- case 'RBEmpty':- return {ctor:"_Tuple2", _0:t._1, _1:t._2};- }- return min(t._3);- }_E.Case($moduleName,'between lines 105 and 117')}();};- var Black = {ctor:"Black"};- var ensureBlackRoot = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._0.ctor) {- case 'Red':- return A5(RBNode, Black, t._1, t._2, t._3, t._4);- }break;- }- return t;}();};- var otherColor = function(c){- return function(){- switch (c.ctor) {- case 'Black':- return Red;- case 'Red':- return Black;- }_E.Case($moduleName,'on line 186, column 16 to 57')}();};- var color_flip = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBNode':- return A5(RBNode, otherColor(t._0), t._1, t._2, A5(RBNode, otherColor(t._3._0), t._3._1, t._3._2, t._3._3, t._3._4), A5(RBNode, otherColor(t._4._0), t._4._1, t._4._2, t._4._3, t._4._4));- }break;- }break;- }- return Native.Error.raise(_str('color_flip called on a Empty or Node with a Empty child'));}();};- var color_flipIfNeeded = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBNode':- switch (t._3._0.ctor) {- case 'Red':- switch (t._4.ctor) {- case 'RBNode':- switch (t._4._0.ctor) {- case 'Red':- return color_flip(t);- }break;- }break;- }break;- }break;- }- return t;}();};- var fixUp = function(t){- return color_flipIfNeeded(rotateRightIfNeeded(rotateLeftIfNeeded(t)));};- var insert = F3(function(k, v, t){- return function(){- var ins = function(t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return A5(RBNode, Red, k, v, RBEmpty, RBEmpty);- case 'RBNode':- return function(){- var h = function(){- var case192 = A2(Native.Utils.compare, k, t._1);- switch (case192.ctor) {- case 'EQ':- return A5(RBNode, t._0, t._1, v, t._3, t._4);- case 'GT':- return A5(RBNode, t._0, t._1, t._2, t._3, ins(t._4));- case 'LT':- return A5(RBNode, t._0, t._1, t._2, ins(t._3), t._4);- }_E.Case($moduleName,'between lines 219 and 223')}();- return fixUp(h);}();- }_E.Case($moduleName,'between lines 216 and 224')}();};- return ensureBlackRoot(ins(t));}();});- var fromList = function(assocs){- return A3(List.foldl, F2(function(arg2, d){- return function(){- switch (arg2.ctor) {- case '_Tuple2':- return A3(insert, arg2._0, arg2._1, d);- }_E.Case($moduleName,'on line 403, column 43 to 55')}();}), empty, assocs);};- var intersect = F2(function(t1, t2){- return function(){- var combine = F3(function(k, v, t){- return (A2(member, k, t2) ? A3(insert, k, v, t) : (Basics.otherwise ? t : _E.If($moduleName,'on line 381, column 22 to 63')));});- return A3(foldl, combine, empty, t1);}();});- var singleton = F2(function(k, v){- return A3(insert, k, v, RBEmpty);});- var union = F2(function(t1, t2){- return A3(foldl, insert, t2, t1);});- var moveRedLeft = function(t){- return function(){- var t$ = color_flip(t);- return function(){- switch (t$.ctor) {- case 'RBNode':- return function(){- switch (t$._4.ctor) {- case 'RBNode':- switch (t$._4._3.ctor) {- case 'RBNode':- switch (t$._4._3._0.ctor) {- case 'Red':- return color_flip(rotateLeft(A5(RBNode, t$._0, t$._1, t$._2, t$._3, rotateRight(t$._4))));- }break;- }break;- }- return t$;}();- }- return t$;}();}();};- var moveRedLeftIfNeeded = function(t){- return ((isRedLeft(t)||isRedLeftLeft(t)) ? t : (Basics.otherwise ? moveRedLeft(t) : _E.If($moduleName,'on line 286, column 3 to 62')));};- var deleteMin = function(t){- return function(){- var del = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._3.ctor) {- case 'RBEmpty':- return RBEmpty;- }break;- }- return function(){- var case219 = moveRedLeftIfNeeded(t);- switch (case219.ctor) {- case 'RBEmpty':- return RBEmpty;- case 'RBNode':- return fixUp(A5(RBNode, case219._0, case219._1, case219._2, del(case219._3), case219._4));- }_E.Case($moduleName,'between lines 297 and 300')}();}();};- return ensureBlackRoot(del(t));}();};- var moveRedRight = function(t){- return function(){- var t$ = color_flip(t);- return (isRedLeftLeft(t$) ? color_flip(rotateRight(t$)) : (Basics.otherwise ? t$ : _E.If($moduleName,'on line 282, column 3 to 63')));}();};- var moveRedRightIfNeeded = function(t){- return ((isRedRight(t)||isRedRightLeft(t)) ? t : (Basics.otherwise ? moveRedRight(t) : _E.If($moduleName,'on line 290, column 3 to 65')));};- var remove = F2(function(k, t){- return function(){- var eq_and_noRightNode = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- switch (t._4.ctor) {- case 'RBEmpty':- return _N.eq(k,t._1);- }break;- }- return false;}();};- var eq = function(t){- return function(){- switch (t.ctor) {- case 'RBNode':- return _N.eq(k,t._1);- }- return false;}();};- var delEQ = function(t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return Native.Error.raise(_str('delEQ called on a Empty'));- case 'RBNode':- return function(){- var _243 = min(t._4);- var k$ = function(){- switch (_243.ctor) {- case '_Tuple2':- return k$;- }_E.Case($moduleName,'on line 326, column 53 to 58')}();- var v$ = function(){- switch (_243.ctor) {- case '_Tuple2':- return v$;- }_E.Case($moduleName,'on line 326, column 53 to 58')}();- return fixUp(A5(RBNode, t._0, k$, v$, t._3, deleteMin(t._4)));}();- }_E.Case($moduleName,'between lines 325 and 329')}();};- var del = function(t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return RBEmpty;- case 'RBNode':- return ((_N.cmp(k,t._1)<0) ? delLT(t) : (Basics.otherwise ? function(){- var u = (isRedLeft(t) ? rotateRight(t) : (Basics.otherwise ? t : _E.If($moduleName,'on line 336, column 33 to 73')));- return (eq_and_noRightNode(u) ? RBEmpty : (Basics.otherwise ? function(){- var t$ = moveRedRightIfNeeded(t);- return (eq(t$) ? delEQ(t$) : (Basics.otherwise ? delGT(t$) : _E.If($moduleName,'on line 339, column 29 to 65')));}() : _E.If($moduleName,'between lines 337 and 339')));}() : _E.If($moduleName,'between lines 335 and 339')));- }_E.Case($moduleName,'between lines 332 and 340')}();};- var delGT = function(t){- return function(){- switch (t.ctor) {- case 'RBEmpty':- return Native.Error.raise(_str('delGT called on a Empty'));- case 'RBNode':- return fixUp(A5(RBNode, t._0, t._1, t._2, t._3, del(t._4)));- }_E.Case($moduleName,'between lines 329 and 332')}();};- var delLT = function(t){- return function(){- var case262 = moveRedLeftIfNeeded(t);- switch (case262.ctor) {- case 'RBEmpty':- return Native.Error.raise(_str('delLT on Empty'));- case 'RBNode':- return fixUp(A5(RBNode, case262._0, case262._1, case262._2, del(case262._3), case262._4));- }_E.Case($moduleName,'between lines 322 and 325')}();};- return (A2(member, k, t) ? ensureBlackRoot(del(t)) : (Basics.otherwise ? t : _E.If($moduleName,'on line 340, column 7 to 56')));}();});- var diff = F2(function(t1, t2){- return A3(foldl, F3(function(k, v, t){- return A2(remove, k, t);}), t1, t2);});- return elm.Dict = {- _op : _op, - empty : empty, - singleton : singleton, - insert : insert, - lookup : lookup, - findWithDefault : findWithDefault, - remove : remove, - member : member, - foldl : foldl, - foldr : foldr, - map : map, - union : union, - intersect : intersect, - diff : diff, - keys : keys, - values : values, - toList : toList, - fromList : fromList};};-Elm.Either = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Either';- var List = Elm.List(elm);- var _op = {};- var Right = function(a){- return {ctor:"Right", _0:a};};- var isRight = function(e){- return function(){- switch (e.ctor) {- case 'Right':- return true;- }- return false;}();};- var Left = function(a){- return {ctor:"Left", _0:a};};- var consEither = F2(function(e, arg1){- return function(){- switch (arg1.ctor) {- case '_Tuple2':- return function(){- switch (e.ctor) {- case 'Left':- return {ctor:"_Tuple2", _0:_L.Cons(e._0,arg1._0), _1:arg1._1};- case 'Right':- return {ctor:"_Tuple2", _0:arg1._0, _1:_L.Cons(e._0,arg1._1)};- }_E.Case($moduleName,'between lines 50 and 52')}();- }_E.Case($moduleName,'between lines 50 and 52')}();});- var partition = function(es){- return A3(List.foldr, consEither, {ctor:"_Tuple2", _0:_J.toList([]), _1:_J.toList([])}, es);};- var consLeft = F2(function(e, vs){- return function(){- switch (e.ctor) {- case 'Left':- return _L.Cons(e._0,vs);- case 'Right':- return vs;- }_E.Case($moduleName,'between lines 40 and 42')}();});- var lefts = function(es){- return A3(List.foldr, consLeft, _J.toList([]), es);};- var consRight = F2(function(e, vs){- return function(){- switch (e.ctor) {- case 'Left':- return vs;- case 'Right':- return _L.Cons(e._0,vs);- }_E.Case($moduleName,'between lines 45 and 47')}();});- var rights = function(es){- return A3(List.foldr, consRight, _J.toList([]), es);};- var either = F3(function(f, g, e){- return function(){- switch (e.ctor) {- case 'Left':- return f(e._0);- case 'Right':- return g(e._0);- }_E.Case($moduleName,'on line 16, column 16 to 60')}();});- var isLeft = function(e){- return function(){- switch (e.ctor) {- case 'Left':- return true;- }- return false;}();};- return elm.Either = {- _op : _op, - either : either, - isLeft : isLeft, - isRight : isRight, - lefts : lefts, - rights : rights, - partition : partition, - consLeft : consLeft, - consRight : consRight, - consEither : consEither, - Left : Left, - Right : Right};};-Elm.Http = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Http';- var Basics = Elm.Basics(elm);- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Http = Elm.Native.Http(elm);- var _op = {};- var send = Native.Http.send;- var Waiting = {ctor:"Waiting"};- var Success = function(a){- return {ctor:"Success", _0:a};};- var Request = F4(function(a, b, c, d){- return {- _:{- },- body:c,- headers:d,- url:b,- verb:a};});- var get = function(url){- return A4(Request, _str('GET'), url, _str(''), _J.toList([]));};- var sendGet = function(reqs){- return send(A2(Signal.lift, get, reqs));};- var post = F2(function(url, body){- return A4(Request, _str('POST'), url, body, _J.toList([]));});- var request = Request;- var Failure = F2(function(a, b){- return {ctor:"Failure", _0:a, _1:b};});- return elm.Http = {- _op : _op, - request : request, - get : get, - post : post, - send : send, - sendGet : sendGet, - Success : Success, - Waiting : Waiting, - Failure : Failure};};-Elm.JavaScript = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'JavaScript';- var Native = Native || {};- Native.JavaScript = Elm.Native.JavaScript(elm);- var Basics = Elm.Basics(elm);- var _op = {};- var toString = Native.JavaScript.toString;- var toList = Native.JavaScript.toList;- var toInt = Native.JavaScript.toInt;- var toFloat = Native.JavaScript.toFloat;- var toBool = Native.JavaScript.toBool;- var fromString = Native.JavaScript.fromString;- var fromList = Native.JavaScript.fromList;- var fromInt = Native.JavaScript.fromInt;- var fromFloat = Native.JavaScript.fromFloat;- var fromBool = Native.JavaScript.fromBool;- var JSString = {ctor:"JSString"};- var JSObject = {ctor:"JSObject"};- var JSNumber = {ctor:"JSNumber"};- var JSDomNode = {ctor:"JSDomNode"};- var JSBool = {ctor:"JSBool"};- var JSArray = function(a){- return {ctor:"JSArray", _0:a};};- return elm.JavaScript = {- _op : _op, - toList : toList, - toInt : toInt, - toFloat : toFloat, - toBool : toBool, - toString : toString, - fromList : fromList, - fromInt : fromInt, - fromFloat : fromFloat, - fromBool : fromBool, - fromString : fromString, - JSNumber : JSNumber, - JSBool : JSBool, - JSString : JSString, - JSArray : JSArray, - JSDomNode : JSDomNode, - JSObject : JSObject};};-Elm.Json = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Json';- var Basics = Elm.Basics(elm);- var Dict = Elm.Dict(elm);- var Maybe = Elm.Maybe(elm);- var JavaScript = Elm.JavaScript(elm);- var Native = Native || {};- Native.Json = Elm.Native.Json(elm);- var JavaScript = Elm.JavaScript(elm);- var _op = {};- var toString = F2(function(sep, v){- return JavaScript.toString(A2(Native.Json.toJSString, sep, v));});- var toJSString = Native.Json.toJSString;- var toJSObject = Native.Json.toJSObject;- var fromString = function(s){- return Native.Json.fromJSString(JavaScript.fromString(s));};- var fromJSString = Native.Json.fromJSString;- var fromJSObject = Native.Json.fromJSObject;- var String = function(a){- return {ctor:"String", _0:a};};- var Object = function(a){- return {ctor:"Object", _0:a};};- var Number = function(a){- return {ctor:"Number", _0:a};};- var Null = {ctor:"Null"};- var Boolean = function(a){- return {ctor:"Boolean", _0:a};};- var Array = function(a){- return {ctor:"Array", _0:a};};- return elm.Json = {- _op : _op, - toString : toString, - toJSString : toJSString, - fromString : fromString, - fromJSString : fromJSString, - fromJSObject : fromJSObject, - toJSObject : toJSObject, - String : String, - Number : Number, - Boolean : Boolean, - Null : Null, - Array : Array, - Object : Object};};-Elm.Keyboard = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Keyboard';- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Keyboard = Elm.Native.Keyboard(elm);- var _op = {};- var lastPressed = Native.Keyboard.lastPressed;- var keysDown = Native.Keyboard.keysDown;- var isDown = Native.Keyboard.isDown;- var shift = isDown(16);- var space = isDown(32);- var enter = isDown(13);- var directions = Native.Keyboard.directions;- var wasd = A4(directions, 87, 83, 65, 68);- var ctrl = isDown(17);- var arrows = A4(directions, 38, 40, 37, 39);- return elm.Keyboard = {- _op : _op, - directions : directions, - arrows : arrows, - wasd : wasd, - isDown : isDown, - shift : shift, - ctrl : ctrl, - space : space, - enter : enter, - keysDown : keysDown, - lastPressed : lastPressed};};-Elm.List = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'List';- var Basics = Elm.Basics(elm);- var Native = Native || {};- Native.List = Elm.Native.List(elm);- var _op = {};- var zipWith = Native.List.zipWith;- var zip = Native.List.zip;- var take = Native.List.take;- var tail = Native.List.tail;- var split = Native.List.split;- var scanl1 = Native.List.scanl1;- var scanl = Native.List.scanl;- var reverse = Native.List.reverse;- var map = Native.List.map;- var length = Native.List.length;- var last = Native.List.last;- var join = Native.List.join;- var isEmpty = function(xs){- return function(){- switch (xs.ctor) {- case '[]':- return true;- }- return false;}();};- var head = Native.List.head;- var foldr1 = Native.List.foldr1;- var foldr = Native.List.foldr;- var foldl1 = Native.List.foldl1;- var maximum = foldl1(Basics.max);- var minimum = foldl1(Basics.min);- var foldl = Native.List.foldl;- var or = A2(foldl, F2(function(x, y){- return (x||y);}), false);- var product = A2(foldl, F2(function(x, y){- return (x*y);}), 1);- var sum = A2(foldl, F2(function(x, y){- return (x+y);}), 0);- var filter = Native.List.filter;- var drop = Native.List.drop;- var concat = Native.List.concat;- var concatMap = F2(function(f, list){- return concat(A2(map, f, list));});- var any = Native.List.any;- var and = A2(foldl, F2(function(x, y){- return (x&&y);}), true);- var all = Native.List.all;- _op['::'] = Native.List.cons;- var intersperse = F2(function(sep, xs){- return function(){- switch (xs.ctor) {- case '::':- switch (xs._1.ctor) {- case '::':- return _L.Cons(xs._0,_L.Cons(sep,A2(intersperse, sep, _L.Cons(xs._1._0,xs._1._1))));- case '[]':- return _J.toList([xs._0]);- }break;- case '[]':- return _J.toList([]);- }_E.Case($moduleName,'between lines 176 and 179')}();});- var partition = F2(function(pred, lst){- return function(){- switch (lst.ctor) {- case '::':- return function(){- var _9 = A2(partition, pred, lst._1);- var bs = function(){- switch (_9.ctor) {- case '_Tuple2':- return _9._0;- }_E.Case($moduleName,'on line 133, column 30 to 47')}();- var cs = function(){- switch (_9.ctor) {- case '_Tuple2':- return _9._1;- }_E.Case($moduleName,'on line 133, column 30 to 47')}();- return (pred(lst._0) ? {ctor:"_Tuple2", _0:_L.Cons(lst._0,bs), _1:cs} : (Basics.otherwise ? {ctor:"_Tuple2", _0:bs, _1:_L.Cons(lst._0,cs)} : _E.If($moduleName,'on line 134, column 16 to 57')));}();- case '[]':- return {ctor:"_Tuple2", _0:_J.toList([]), _1:_J.toList([])};- }_E.Case($moduleName,'between lines 131 and 134')}();});- var unzip = function(pairs){- return function(){- switch (pairs.ctor) {- case '::':- switch (pairs._0.ctor) {- case '_Tuple2':- return function(){- var _21 = unzip(pairs._1);- var xs = function(){- switch (_21.ctor) {- case '_Tuple2':- return _21._0;- }_E.Case($moduleName,'on line 156, column 33 to 41')}();- var ys = function(){- switch (_21.ctor) {- case '_Tuple2':- return _21._1;- }_E.Case($moduleName,'on line 156, column 33 to 41')}();- return {ctor:"_Tuple2", _0:_L.Cons(pairs._0._0,xs), _1:_L.Cons(pairs._0._1,ys)};}();- }break;- case '[]':- return {ctor:"_Tuple2", _0:_J.toList([]), _1:_J.toList([])};- }_E.Case($moduleName,'between lines 154 and 156')}();};- _op['++'] = Native.List.append;- return elm.List = {- _op : _op, - head : head, - tail : tail, - last : last, - isEmpty : isEmpty, - map : map, - foldl : foldl, - foldr : foldr, - foldl1 : foldl1, - foldr1 : foldr1, - scanl : scanl, - scanl1 : scanl1, - filter : filter, - length : length, - reverse : reverse, - all : all, - any : any, - and : and, - or : or, - concat : concat, - concatMap : concatMap, - sum : sum, - product : product, - maximum : maximum, - minimum : minimum, - partition : partition, - zip : zip, - zipWith : zipWith, - unzip : unzip, - split : split, - join : join, - intersperse : intersperse, - take : take, - drop : drop};};-Elm.Matrix2D = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Matrix2D';- var Native = Native || {};- Native.Matrix2D = Elm.Native.Matrix2D(elm);- var _op = {};- var rotation = Native.Matrix2D.rotation;- var multiply = Native.Matrix2D.multiply;- var matrix = Native.Matrix2D.matrix;- var identity = Native.Matrix2D.identity;- var Matrix2D = {ctor:"Matrix2D"};- return elm.Matrix2D = {- _op : _op, - identity : identity, - matrix : matrix, - rotation : rotation, - multiply : multiply, - Matrix2D : Matrix2D};};-Elm.Maybe = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Maybe';- var Basics = Elm.Basics(elm);- var List = Elm.List(elm);- var _op = {};- var Nothing = {ctor:"Nothing"};- var Just = function(a){- return {ctor:"Just", _0:a};};- var maybe = F3(function(b, f, m){- return function(){- switch (m.ctor) {- case 'Just':- return f(m._0);- case 'Nothing':- return b;- }_E.Case($moduleName,'between lines 14 and 16')}();});- var cons = F2(function(mx, xs){- return A3(maybe, xs, function(x){- return _L.Cons(x,xs);}, mx);});- var justs = A2(List.foldr, cons, _J.toList([]));- var isJust = A2(maybe, false, function(arg1){- return function(){- return true;}();});- var isNothing = function($){- return Basics.not(isJust($));};- return elm.Maybe = {- _op : _op, - maybe : maybe, - isJust : isJust, - isNothing : isNothing, - cons : cons, - justs : justs, - Just : Just, - Nothing : Nothing};};-Elm.Mouse = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Mouse';- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Mouse = Elm.Native.Mouse(elm);- var _op = {};- var y = Native.Mouse.y;- var x = Native.Mouse.x;- var position = Native.Mouse.position;- var isDown = Native.Mouse.isDown;- var isClicked = Native.Mouse.isClicked;- var clicks = Native.Mouse.clicks;- return elm.Mouse = {- _op : _op, - position : position, - x : x, - y : y, - isDown : isDown, - isClicked : isClicked, - clicks : clicks};};-Elm.Prelude = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Prelude';- var Basics = Elm.Basics(elm);- var Maybe = Elm.Maybe(elm);- var Native = Native || {};- Native.Prelude = Elm.Native.Prelude(elm);- var Native = Native || {};- Native.Show = Elm.Native.Show(elm);- var _op = {};- var show = Native.Show.show;- var readInt = Native.Prelude.readInt;- var readFloat = Native.Prelude.readFloat;- return elm.Prelude = {- _op : _op, - show : show, - readInt : readInt, - readFloat : readFloat};};-Elm.Random = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Random';- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Random = Elm.Native.Random(elm);- var _op = {};- var range = Native.Random.range;- var float = Native.Random.float;- return elm.Random = {- _op : _op, - range : range, - float : float};};-Elm.Set = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Set';- var Maybe = Elm.Maybe(elm);- var Dict = Elm.Dict(elm);- var List = Elm.List(elm);- var _op = {};- var union = Dict.union;- var toList = Dict.keys;- var singleton = function(k){- return A2(Dict.singleton, k, {ctor:"_Tuple0"});};- var remove = Dict.remove;- var member = Dict.member;- var intersect = Dict.intersect;- var insert = function(k){- return A2(Dict.insert, k, {ctor:"_Tuple0"});};- var foldr = F3(function(f, b, s){- return A3(Dict.foldr, F3(function(k, arg2, b){- return function(){- return A2(f, k, b);}();}), b, s);});- var foldl = F3(function(f, b, s){- return A3(Dict.foldl, F3(function(k, arg2, b){- return function(){- return A2(f, k, b);}();}), b, s);});- var empty = Dict.empty;- var fromList = function(xs){- return A3(List.foldl, insert, empty, xs);};- var map = F2(function(f, s){- return fromList(A2(List.map, f, toList(s)));});- var diff = Dict.diff;- return elm.Set = {- _op : _op, - empty : empty, - singleton : singleton, - insert : insert, - remove : remove, - member : member, - foldl : foldl, - foldr : foldr, - map : map, - union : union, - intersect : intersect, - diff : diff, - toList : toList, - fromList : fromList};};-Elm.Signal = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Signal';- var Native = Native || {};- Native.Signal = Elm.Native.Signal(elm);- var List = Elm.List(elm);- var _op = {};- _op['~'] = F2(function(sf, s){- return A3(Native.Signal.lift2, F2(function(f, x){- return f(x);}), sf, s);});- var sampleOn = Native.Signal.sampleOn;- var merges = Native.Signal.merges;- var merge = Native.Signal.merge;- var lift8 = Native.Signal.lift8;- var lift7 = Native.Signal.lift7;- var lift6 = Native.Signal.lift6;- var lift5 = Native.Signal.lift5;- var lift4 = Native.Signal.lift4;- var lift3 = Native.Signal.lift3;- var lift2 = Native.Signal.lift2;- var lift = Native.Signal.lift;- var keepWhen = Native.Signal.keepWhen;- var keepIf = Native.Signal.keepIf;- var foldp = Native.Signal.foldp;- var dropWhen = Native.Signal.dropWhen;- var dropRepeats = Native.Signal.dropRepeats;- var dropIf = Native.Signal.dropIf;- var countIf = Native.Signal.countIf;- var count = Native.Signal.count;- var constant = Native.Signal.constant;- var combine = A2(List.foldr, Native.Signal.lift2(F2(function(x, y){- return _L.Cons(x,y);})), Native.Signal.constant(_J.toList([])));- var Signal = {ctor:"Signal"};- _op['<~'] = F2(function(f, s){- return A2(Native.Signal.lift, f, s);});- return elm.Signal = {- _op : _op, - constant : constant, - lift : lift, - lift2 : lift2, - lift3 : lift3, - lift4 : lift4, - lift5 : lift5, - lift6 : lift6, - lift7 : lift7, - lift8 : lift8, - foldp : foldp, - merge : merge, - merges : merges, - combine : combine, - count : count, - countIf : countIf, - keepIf : keepIf, - dropIf : dropIf, - keepWhen : keepWhen, - dropWhen : dropWhen, - dropRepeats : dropRepeats, - sampleOn : sampleOn, - Signal : Signal};};-Elm.Text = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Text';- var Basics = Elm.Basics(elm);- var Color = Elm.Color(elm);- var Graphics = Graphics || {};- Graphics.Element = Elm.Graphics.Element(elm);- var Maybe = Elm.Maybe(elm);- var JavaScript = Elm.JavaScript(elm);- var Native = Native || {};- Native.Text = Elm.Native.Text(elm);- var _op = {};- var underline = Native.Text.underline;- var typeface = Native.Text.typeface;- var toText = Native.Text.toText;- var text = Native.Text.text;- var strikeThrough = Native.Text.strikeThrough;- var righted = Native.Text.righted;- var plainText = Native.Text.plainText;- var overline = Native.Text.overline;- var monospace = Native.Text.monospace;- var link = Native.Text.link;- var justified = Native.Text.justified;- var italic = Native.Text.italic;- var height = Native.Text.height;- var header = Native.Text.header;- var color = Native.Text.color;- var centered = Native.Text.centered;- var bold = Native.Text.bold;- var asText = Native.Text.asText;- var Text = {ctor:"Text"};- return elm.Text = {- _op : _op, - toText : toText, - typeface : typeface, - monospace : monospace, - header : header, - link : link, - height : height, - color : color, - bold : bold, - italic : italic, - overline : overline, - underline : underline, - strikeThrough : strikeThrough, - justified : justified, - centered : centered, - righted : righted, - text : text, - plainText : plainText, - asText : asText, - Text : Text};};-Elm.Time = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Time';- var Basics = Elm.Basics(elm);- var Native = Native || {};- Native.Time = Elm.Native.Time(elm);- var Signal = Elm.Signal(elm);- var _op = {};- var timestamp = Native.Time.timestamp;- var since = Native.Time.since;- var millisecond = 1;- var second = (1000*millisecond);- var minute = (60*second);- var inSeconds = function(t){- return (t/second);};- var inMinutes = function(t){- return (t/minute);};- var inMilliseconds = function(t){- return t;};- var hour = (60*minute);- var inHours = function(t){- return (t/hour);};- var fpsWhen = Native.Time.fpsWhen;- var fps = Native.Time.fps;- var every = Native.Time.every;- var delay = Native.Time.delay;- return elm.Time = {- _op : _op, - millisecond : millisecond, - second : second, - minute : minute, - hour : hour, - inMilliseconds : inMilliseconds, - inSeconds : inSeconds, - inMinutes : inMinutes, - inHours : inHours, - fps : fps, - fpsWhen : fpsWhen, - every : every, - since : since, - timestamp : timestamp, - delay : delay};};-Elm.Touch = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Touch';- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Touch = Elm.Native.Touch(elm);- var Time = Elm.Time(elm);- var _op = {};- var touches = Native.Touch.touches;- var taps = Native.Touch.taps;- var Touch = F6(function(a, b, c, d, e, f){- return {- _:{- },- id:c,- t0:f,- x:a,- x0:d,- y:b,- y0:e};});- return elm.Touch = {- _op : _op, - touches : touches, - taps : taps};};-Elm.WebSocket = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'WebSocket';- var Signal = Elm.Signal(elm);- var Basics = Elm.Basics(elm);- var Native = Native || {};- Native.WebSocket = Elm.Native.WebSocket(elm);- var _op = {};- var connect = Native.WebSocket.connect;- return elm.WebSocket = {- _op : _op, - connect : connect};};-Elm.Window = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Window';- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Window = Elm.Native.Window(elm);- var _op = {};- var width = Native.Window.width;- var height = Native.Window.height;- var dimensions = Native.Window.dimensions;- return elm.Window = {- _op : _op, - dimensions : dimensions, - width : width, - height : height};};-Elm.Graphics = Elm.Graphics || {};-Elm.Graphics.Collage = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Graphics.Collage';- var Basics = Elm.Basics(elm);- var List = Elm.List(elm);- var Either = Elm.Either(elm);- var Matrix2D = Elm.Matrix2D(elm);- var Native = Native || {};- Native.Graphics = Native.Graphics || {};- Native.Graphics.Collage = Elm.Native.Graphics.Collage(elm);- var Graphics = Graphics || {};- Graphics.Element = Elm.Graphics.Element(elm);- var Color = Elm.Color(elm);- var Maybe = Elm.Maybe(elm);- var JavaScript = Elm.JavaScript(elm);- var _op = {};- var segment = F2(function(p1, p2){- return _J.toList([p1,p2]);});- var scale = F2(function(s, f){- return _N.replace([['scale',(f.scale*s)]], f);});- var rotate = F2(function(t, f){- return _N.replace([['theta',(f.theta+t)]], f);});- var rect = F2(function(w, h){- return function(){- var hw = (w/2);- var hh = (h/2);- return _J.toList([{ctor:"_Tuple2", _0:(0-hw), _1:(0-hh)},{ctor:"_Tuple2", _0:(0-hw), _1:hh},{ctor:"_Tuple2", _0:hw, _1:hh},{ctor:"_Tuple2", _0:hw, _1:(0-hh)}]);}();});- var square = function(n){- return A2(rect, n, n);};- var polygon = function(points){- return points;};- var path = function(ps){- return ps;};- var oval = F2(function(w, h){- return function(){- var n = 50;- var t = ((2*Basics.pi)/n);- var hw = (w/2);- var hh = (h/2);- var f = function(i){- return {ctor:"_Tuple2", _0:(hw*Basics.cos((t*i))), _1:(hh*Basics.sin((t*i)))};};- return A2(List.map, f, _L.range(0,(n-1)));}();});- var ngon = F2(function(n, r){- return function(){- var m = Basics.toFloat(n);- var t = ((2*Basics.pi)/m);- var f = function(i){- return {ctor:"_Tuple2", _0:(r*Basics.cos((t*i))), _1:(r*Basics.sin((t*i)))};};- return A2(List.map, f, _L.range(0,(m-1)));}();});- var moveY = F2(function(y, f){- return _N.replace([['y',(f.y+y)]], f);});- var moveX = F2(function(x, f){- return _N.replace([['x',(f.x+x)]], f);});- var move = F2(function(arg2, f){- return function(){- switch (arg2.ctor) {- case '_Tuple2':- return _N.replace([['x',(f.x+arg2._0)],['y',(f.y+arg2._1)]], f);- }_E.Case($moduleName,'on line 142, column 20 to 48')}();});- var form = function(f){- return {- _:{- },- alpha:1,- form:f,- scale:1,- theta:0,- x:0,- y:0};};- var collage = Native.Graphics.Collage.collage;- var circle = function(r){- return A2(oval, (2*r), (2*r));};- var alpha = F2(function(a, f){- return _N.replace([['alpha',a]], f);});- var Texture = function(a){- return {ctor:"Texture", _0:a};};- var Solid = function(a){- return {ctor:"Solid", _0:a};};- var Smooth = {ctor:"Smooth"};- var Sharp = function(a){- return {ctor:"Sharp", _0:a};};- var Round = {ctor:"Round"};- var Padded = {ctor:"Padded"};- var LineStyle = F6(function(a, b, c, d, e, f){- return {- _:{- },- cap:c,- color:a,- dashOffset:f,- dashing:e,- join:d,- width:b};});- var Grad = function(a){- return {ctor:"Grad", _0:a};};- var Form = F6(function(a, b, c, d, e, f){- return {- _:{- },- alpha:e,- form:f,- scale:b,- theta:a,- x:c,- y:d};});- var Flat = {ctor:"Flat"};- var defaultLine = {- _:{- },- cap:Flat,- color:Color.black,- dashOffset:0,- dashing:_J.toList([]),- join:Sharp(10),- width:1};- var dashed = function(clr){- return _N.replace([['color',clr],['dashing',_J.toList([8,4])]], defaultLine);};- var dotted = function(clr){- return _N.replace([['color',clr],['dashing',_J.toList([3,3])]], defaultLine);};- var solid = function(clr){- return _N.replace([['color',clr]], defaultLine);};- var FShape = F2(function(a, b){- return {ctor:"FShape", _0:a, _1:b};});- var fill = F2(function(style, shape){- return form(A2(FShape, Either.Right(style), shape));});- var filled = F2(function(color, shape){- return A2(fill, Solid(color), shape);});- var gradient = F2(function(grad, shape){- return A2(fill, Grad(grad), shape);});- var textured = F2(function(src, shape){- return A2(fill, Texture(src), shape);});- var outlined = F2(function(style, shape){- return form(A2(FShape, Either.Left(style), shape));});- var FPath = F2(function(a, b){- return {ctor:"FPath", _0:a, _1:b};});- var traced = F2(function(style, path){- return form(A2(FPath, style, path));});- var FImage = F4(function(a, b, c, d){- return {ctor:"FImage", _0:a, _1:b, _2:c, _3:d};});- var sprite = F4(function(w, h, pos, src){- return form(A4(FImage, w, h, pos, src));});- var FGroup = F2(function(a, b){- return {ctor:"FGroup", _0:a, _1:b};});- var group = function(fs){- return form(A2(FGroup, Matrix2D.identity, fs));};- var groupTransform = F2(function(matrix, fs){- return form(A2(FGroup, matrix, fs));});- var FElement = function(a){- return {ctor:"FElement", _0:a};};- var toForm = function(e){- return form(FElement(e));};- var Clipped = {ctor:"Clipped"};- elm.Graphics = elm.Graphics || {};- return elm.Graphics.Collage = {- _op : _op, - defaultLine : defaultLine, - solid : solid, - dashed : dashed, - dotted : dotted, - form : form, - fill : fill, - filled : filled, - textured : textured, - gradient : gradient, - outlined : outlined, - traced : traced, - sprite : sprite, - toForm : toForm, - group : group, - groupTransform : groupTransform, - rotate : rotate, - scale : scale, - move : move, - moveX : moveX, - moveY : moveY, - alpha : alpha, - collage : collage, - path : path, - segment : segment, - polygon : polygon, - rect : rect, - square : square, - oval : oval, - circle : circle, - ngon : ngon, - Solid : Solid, - Texture : Texture, - Grad : Grad, - Flat : Flat, - Round : Round, - Padded : Padded, - Smooth : Smooth, - Sharp : Sharp, - Clipped : Clipped, - FPath : FPath, - FShape : FShape, - FImage : FImage, - FElement : FElement, - FGroup : FGroup};};-Elm.Graphics = Elm.Graphics || {};-Elm.Graphics.Element = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Graphics.Element';- var Basics = Elm.Basics(elm);- var Native = Native || {};- Native.Utils = Elm.Native.Utils(elm);- var JavaScript = Elm.JavaScript(elm);- var JavaScript = Elm.JavaScript(elm);- var List = Elm.List(elm);- var Color = Elm.Color(elm);- var Maybe = Elm.Maybe(elm);- var _op = {};- var widthOf = function(e){- return e.props.width;};- var tag = F2(function(name, e){- return function(){- var p = e.props;- return {- _:{- },- element:e.element,- props:_N.replace([['tag',JavaScript.fromString(name)]], p)};}();});- var sizeOf = function(e){- return {ctor:"_Tuple2", _0:e.props.width, _1:e.props.height};};- var opacity = F2(function(o, e){- return function(){- var p = e.props;- return {- _:{- },- element:e.element,- props:_N.replace([['opacity',o]], p)};}();});- var markdown = Native.Utils.undefined;- var link = F2(function(href, e){- return function(){- var p = e.props;- return {- _:{- },- element:e.element,- props:_N.replace([['href',JavaScript.fromString(href)]], p)};}();});- var heightOf = function(e){- return e.props.height;};- var emptyStr = JavaScript.fromString(_str(''));- var color = F2(function(c, e){- return function(){- var p = e.props;- return {- _:{- },- element:e.element,- props:_N.replace([['color',Maybe.Just(c)]], p)};}();});- var Z = {ctor:"Z"};- var middleAt = F2(function(x, y){- return {- _:{- },- horizontal:Z,- vertical:Z,- x:x,- y:y};});- var Tiled = {ctor:"Tiled"};- var Spacer = {ctor:"Spacer"};- var Relative = function(a){- return {ctor:"Relative", _0:a};};- var middle = {- _:{- },- horizontal:Z,- vertical:Z,- x:Relative(0.5),- y:Relative(0.5)};- var relative = Relative;- var RawHtml = function(a){- return {ctor:"RawHtml", _0:a};};- var Properties = F8(function(a, b, c, d, e, f, g, h){- return {- _:{- },- color:e,- height:c,- hover:h,- href:f,- id:a,- opacity:d,- tag:g,- width:b};});- var newElement = F3(function(w, h, e){- return {- _:{- },- element:e,- props:A8(Properties, Native.Utils.guid({ctor:"_Tuple0"}), w, h, 1, Maybe.Nothing, emptyStr, emptyStr, {ctor:"_Tuple0"})};});- var spacer = F2(function(w, h){- return A3(newElement, w, h, Spacer);});- var Position = F4(function(a, b, c, d){- return {- _:{- },- horizontal:a,- vertical:b,- x:c,- y:d};});- var Plain = {ctor:"Plain"};- var P = {ctor:"P"};- var midRightAt = F2(function(x, y){- return {- _:{- },- horizontal:P,- vertical:Z,- x:x,- y:y};});- var midTopAt = F2(function(x, y){- return {- _:{- },- horizontal:Z,- vertical:P,- x:x,- y:y};});- var topRightAt = F2(function(x, y){- return {- _:{- },- horizontal:P,- vertical:P,- x:x,- y:y};});- var N = {ctor:"N"};- var bottomLeftAt = F2(function(x, y){- return {- _:{- },- horizontal:N,- vertical:N,- x:x,- y:y};});- var bottomRightAt = F2(function(x, y){- return {- _:{- },- horizontal:P,- vertical:N,- x:x,- y:y};});- var midBottomAt = F2(function(x, y){- return {- _:{- },- horizontal:Z,- vertical:N,- x:x,- y:y};});- var midLeftAt = F2(function(x, y){- return {- _:{- },- horizontal:N,- vertical:Z,- x:x,- y:y};});- var topLeftAt = F2(function(x, y){- return {- _:{- },- horizontal:N,- vertical:P,- x:x,- y:y};});- var Image = F4(function(a, b, c, d){- return {ctor:"Image", _0:a, _1:b, _2:c, _3:d};});- var height = F2(function(nh, e){- return function(){- var p = e.props;- var props = function(){- var case0 = e.element;- switch (case0.ctor) {- case 'Image':- return _N.replace([['width',Basics.round(((Basics.toFloat(case0._1)/Basics.toFloat(case0._2))*Basics.toFloat(nh)))]], p);- }- return p;}();- return {- _:{- },- element:e.element,- props:_N.replace([['height',nh]], p)};}();});- var image = F3(function(w, h, src){- return A3(newElement, w, h, A4(Image, Plain, w, h, JavaScript.fromString(src)));});- var tiledImage = F3(function(w, h, src){- return A3(newElement, w, h, A4(Image, Tiled, w, h, JavaScript.fromString(src)));});- var width = F2(function(nw, e){- return function(){- var p = e.props;- var props = function(){- var case5 = e.element;- switch (case5.ctor) {- case 'Image':- return _N.replace([['height',Basics.round(((Basics.toFloat(case5._2)/Basics.toFloat(case5._1))*Basics.toFloat(nw)))]], p);- case 'RawHtml':- return _N.replace([['height',Basics.snd(A2(Native.Utils.htmlHeight, nw, case5._0))]], p);- }- return p;}();- return {- _:{- },- element:e.element,- props:_N.replace([['width',nw]], props)};}();});- var size = F3(function(w, h, e){- return A2(height, h, A2(width, w, e));});- var Flow = F2(function(a, b){- return {ctor:"Flow", _0:a, _1:b};});- var Fitted = {ctor:"Fitted"};- var fittedImage = F3(function(w, h, src){- return A3(newElement, w, h, A4(Image, Fitted, w, h, JavaScript.fromString(src)));});- var Element = F2(function(a, b){- return {- _:{- },- element:b,- props:a};});- var DUp = {ctor:"DUp"};- var up = DUp;- var DRight = {ctor:"DRight"};- var right = DRight;- var beside = F2(function(lft, rht){- return A3(newElement, (widthOf(lft)+widthOf(rht)), A2(Basics.max, heightOf(lft), heightOf(rht)), A2(Flow, right, _J.toList([lft,rht])));});- var DOut = {ctor:"DOut"};- var layers = function(es){- return function(){- var ws = A2(List.map, widthOf, es);- var hs = A2(List.map, heightOf, es);- return A3(newElement, List.maximum(ws), List.maximum(hs), A2(Flow, DOut, es));}();};- var outward = DOut;- var DLeft = {ctor:"DLeft"};- var left = DLeft;- var DIn = {ctor:"DIn"};- var inward = DIn;- var DDown = {ctor:"DDown"};- var above = F2(function(hi, lo){- return A3(newElement, A2(Basics.max, widthOf(hi), widthOf(lo)), (heightOf(hi)+heightOf(lo)), A2(Flow, DDown, _J.toList([hi,lo])));});- var below = F2(function(lo, hi){- return A3(newElement, A2(Basics.max, widthOf(hi), widthOf(lo)), (heightOf(hi)+heightOf(lo)), A2(Flow, DDown, _J.toList([hi,lo])));});- var down = DDown;- var flow = F2(function(dir, es){- return function(){- var ws = A2(List.map, widthOf, es);- var newFlow = F2(function(w, h){- return A3(newElement, w, h, A2(Flow, dir, es));});- var hs = A2(List.map, heightOf, es);- return (_N.eq(es,_J.toList([])) ? A2(spacer, 0, 0) : (Basics.otherwise ? function(){- switch (dir.ctor) {- case 'DDown':- return A2(newFlow, List.maximum(ws), List.sum(hs));- case 'DIn':- return A2(newFlow, List.maximum(ws), List.maximum(hs));- case 'DLeft':- return A2(newFlow, List.sum(ws), List.maximum(hs));- case 'DOut':- return A2(newFlow, List.maximum(ws), List.maximum(hs));- case 'DRight':- return A2(newFlow, List.sum(ws), List.maximum(hs));- case 'DUp':- return A2(newFlow, List.maximum(ws), List.sum(hs));- }_E.Case($moduleName,'between lines 159 and 165')}() : _E.If($moduleName,'between lines 158 and 165')));}();});- var Custom = {ctor:"Custom"};- var Cropped = function(a){- return {ctor:"Cropped", _0:a};};- var croppedImage = F4(function(pos, w, h, src){- return A3(newElement, w, h, A4(Image, Cropped(pos), w, h, JavaScript.fromString(src)));});- var Container = F2(function(a, b){- return {ctor:"Container", _0:a, _1:b};});- var container = F4(function(w, h, pos, e){- return A3(newElement, w, h, A2(Container, pos, e));});- var Absolute = function(a){- return {ctor:"Absolute", _0:a};};- var absolute = Absolute;- var midLeft = _N.replace([['horizontal',N],['x',Absolute(0)]], middle);- var midRight = _N.replace([['horizontal',P]], midLeft);- var midTop = _N.replace([['vertical',P],['y',Absolute(0)]], middle);- var midBottom = _N.replace([['vertical',N]], midTop);- var topLeft = {- _:{- },- horizontal:N,- vertical:P,- x:Absolute(0),- y:Absolute(0)};- var bottomLeft = _N.replace([['vertical',N]], topLeft);- var bottomRight = _N.replace([['horizontal',P]], bottomLeft);- var topRight = _N.replace([['horizontal',P]], topLeft);- elm.Graphics = elm.Graphics || {};- return elm.Graphics.Element = {- _op : _op, - widthOf : widthOf, - heightOf : heightOf, - sizeOf : sizeOf, - width : width, - height : height, - size : size, - opacity : opacity, - color : color, - tag : tag, - link : link, - emptyStr : emptyStr, - newElement : newElement, - image : image, - fittedImage : fittedImage, - croppedImage : croppedImage, - tiledImage : tiledImage, - markdown : markdown, - container : container, - spacer : spacer, - flow : flow, - above : above, - below : below, - beside : beside, - layers : layers, - absolute : absolute, - relative : relative, - middle : middle, - topLeft : topLeft, - topRight : topRight, - bottomLeft : bottomLeft, - bottomRight : bottomRight, - midLeft : midLeft, - midRight : midRight, - midTop : midTop, - midBottom : midBottom, - middleAt : middleAt, - topLeftAt : topLeftAt, - topRightAt : topRightAt, - bottomLeftAt : bottomLeftAt, - bottomRightAt : bottomRightAt, - midLeftAt : midLeftAt, - midRightAt : midRightAt, - midTopAt : midTopAt, - midBottomAt : midBottomAt, - up : up, - down : down, - left : left, - right : right, - inward : inward, - outward : outward, - Image : Image, - Container : Container, - Flow : Flow, - Spacer : Spacer, - RawHtml : RawHtml, - Custom : Custom, - Plain : Plain, - Fitted : Fitted, - Cropped : Cropped, - Tiled : Tiled, - P : P, - Z : Z, - N : N, - Absolute : Absolute, - Relative : Relative, - DUp : DUp, - DDown : DDown, - DLeft : DLeft, - DRight : DRight, - DIn : DIn, - DOut : DOut};};-Elm.Graphics = Elm.Graphics || {};-Elm.Graphics.Input = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'Graphics.Input';- var Basics = Elm.Basics(elm);- var Signal = Elm.Signal(elm);- var Native = Native || {};- Native.Graphics = Native.Graphics || {};- Native.Graphics.Input = Elm.Native.Graphics.Input(elm);- var List = Elm.List(elm);- var Graphics = Graphics || {};- Graphics.Element = Elm.Graphics.Element(elm);- var Color = Elm.Color(elm);- var Maybe = Elm.Maybe(elm);- var JavaScript = Elm.JavaScript(elm);- var _op = {};- var id = function(x){- return x;};- var hoverables = Native.Graphics.Input.hoverables;- var hoverable = function(elem){- return function(){- var pool = hoverables(false);- return {ctor:"_Tuple2", _0:A2(pool.hoverable, id, elem), _1:pool.events};}();};- var fields = Native.Graphics.Input.fields;- var emptyFieldState = {- _:{- },- selectionEnd:0,- selectionStart:0,- string:_str('')};- var field = function(placeHolder){- return function(){- var tfs = fields(emptyFieldState);- var changes = Signal.dropRepeats(tfs.events);- return {ctor:"_Tuple2", _0:A2(Signal.lift, A2(tfs.field, id, placeHolder), changes), _1:Signal.dropRepeats(A2(Signal.lift, function(_){- return _.string;}, changes))};}();};- var password = function(placeHolder){- return function(){- var tfs = Native.Graphics.Input.passwords(emptyFieldState);- var changes = Signal.dropRepeats(tfs.events);- return {ctor:"_Tuple2", _0:A2(Signal.lift, A2(tfs.field, id, placeHolder), changes), _1:Signal.dropRepeats(A2(Signal.lift, function(_){- return _.string;}, changes))};}();};- var email = function(placeHolder){- return function(){- var tfs = Native.Graphics.Input.emails(emptyFieldState);- var changes = Signal.dropRepeats(tfs.events);- return {ctor:"_Tuple2", _0:A2(Signal.lift, A2(tfs.field, id, placeHolder), changes), _1:Signal.dropRepeats(A2(Signal.lift, function(_){- return _.string;}, changes))};}();};- var dropDown = Native.Graphics.Input.dropDown;- var stringDropDown = function(strs){- return dropDown(A2(List.map, function(s){- return {ctor:"_Tuple2", _0:s, _1:s};}, strs));};- var customButtons = Native.Graphics.Input.customButtons;- var customButton = F3(function(up, hover, down){- return function(){- var pool = customButtons({ctor:"_Tuple0"});- return {ctor:"_Tuple2", _0:A4(pool.customButton, {ctor:"_Tuple0"}, up, hover, down), _1:pool.events};}();});- var checkboxes = Native.Graphics.Input.checkboxes;- var checkbox = function(b){- return function(){- var cbs = checkboxes(b);- return {ctor:"_Tuple2", _0:A2(Signal.lift, cbs.checkbox(id), cbs.events), _1:cbs.events};}();};- var buttons = Native.Graphics.Input.buttons;- var button = function(txt){- return function(){- var pool = buttons({ctor:"_Tuple0"});- return {ctor:"_Tuple2", _0:A2(pool.button, {ctor:"_Tuple0"}, txt), _1:pool.events};}();};- var FieldState = F3(function(a, b, c){- return {- _:{- },- selectionEnd:c,- selectionStart:b,- string:a};});- elm.Graphics = elm.Graphics || {};- return elm.Graphics.Input = {- _op : _op, - id : id, - buttons : buttons, - button : button, - customButtons : customButtons, - customButton : customButton, - checkboxes : checkboxes, - checkbox : checkbox, - hoverables : hoverables, - hoverable : hoverable, - fields : fields, - emptyFieldState : emptyFieldState, - field : field, - password : password, - email : email, - dropDown : dropDown, - stringDropDown : stringDropDown};};-Elm.JavaScript = Elm.JavaScript || {};-Elm.JavaScript.Experimental = function(elm){- var N = Elm.Native, _N = N.Utils(elm), _L = N.List(elm), _E = N.Error(elm), _J = N.JavaScript(elm), _str = _J.toString, $moduleName = 'JavaScript.Experimental';- var JavaScript = Elm.JavaScript(elm);- var Native = Native || {};- Native.JavaScript = Elm.Native.JavaScript(elm);- var _op = {};- var toRecord = Native.JavaScript.toRecord;- var fromRecord = Native.JavaScript.fromRecord;- elm.JavaScript = elm.JavaScript || {};- return elm.JavaScript.Experimental = {- _op : _op, - toRecord : toRecord, - fromRecord : fromRecord};};(function() {--// Returns boolean indicating if the swap was successful.-// Requires that the two signal graphs have exactly the same-// structure.-ElmRuntime.swap = function(from, to) {- function similar(nodeOld,nodeNew) {- idOkay = nodeOld.id === nodeNew.id;- lengthOkay = nodeOld.kids.length === nodeNew.kids.length;- return idOkay && lengthOkay;- }- function swap(nodeOld,nodeNew) {- nodeNew.value = nodeOld.value;- return true;- }- var canSwap = depthFirstTraversals(similar, from.inputs, to.inputs);- if (canSwap) { depthFirstTraversals(swap, from.inputs, to.inputs); }- from.node.parentNode.replaceChild(to.node, from.node);- return canSwap;-}--// Returns false if the node operation f ever fails.-function depthFirstTraversals(f, queueOld, queueNew) {- if (queueOld.length !== queueNew.length) return false;- queueOld = queueOld.slice(0);- queueNew = queueNew.slice(0);-- var seen = [];- while (queueOld.length > 0 && queueNew.length > 0) {- var nodeOld = queueOld.pop();- var nodeNew = queueNew.pop();- if (seen.indexOf(nodeOld.id) < 0) {- if (!f(nodeOld, nodeNew)) return false;- queueOld = queueOld.concat(nodeOld.kids);- queueNew = queueNew.concat(nodeNew.kids);- seen.push(nodeOld.id);- }- }- return true;-}--}());--(function() {-'use strict';--Elm.fullscreen = function(module) {- var style = document.createElement('style');- style.type = 'text/css';- style.innerHTML = "html,head,body { padding:0; margin:0; }" +- "body { font-family: calibri, helvetica, arial, sans-serif; }";- document.head.appendChild(style);- var container = document.createElement('div');- document.body.appendChild(container);- return init(ElmRuntime.Display.FULLSCREEN, container, module);-};--Elm.domNode = function(container, module) {- var tag = container.tagName;- if (tag !== 'DIV') {- throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');- } else if (container.hasChildNodes()) {- throw new Error('Elm.node must be given an empty DIV. No children allowed!');- }- return init(ElmRuntime.Display.COMPONENT, container, module);-};--Elm.worker = function(module) {- return init(ElmRuntime.Display.NONE, {}, module);-};--function init(display, container, module, moduleToReplace) {- // defining state needed for an instance of the Elm RTS- var inputs = [];-- function notify(id, v) {- var timestep = Date.now();- var changed = false;- for (var i = inputs.length; i--; ) {- // order is important here to avoid short-circuiting- changed = inputs[i].recv(timestep, id, v) || changed;- }- return changed;- }-- container.offsetX = 0;- container.offsetY = 0;-- var listeners = [];- function addListener(relevantInputs, domNode, eventName, func) {- domNode.addEventListener(eventName, func);- var listener = {- relevantInputs: relevantInputs,- domNode: domNode,- eventName: eventName,- func: func- };- listeners.push(listener);- }-- // create the actual RTS. Any impure modules will attach themselves to this- // object. This permits many Elm programs to be embedded per document.- var elm = {- notify:notify,- node:container,- display:display,- id:ElmRuntime.guid(),- addListener:addListener,- inputs:inputs- };-- // Set up methods to communicate with Elm program from JS.- function send(name, value) {- if (typeof value === 'undefined') return function(v) { return send(name,v); };- var e = document.createEvent('Event');- e.initEvent(name + '_' + elm.id, true, true);- e.value = value;- document.dispatchEvent(e);- }- function recv(name, handler) {- document.addEventListener(name + '_' + elm.id, handler);- }-- recv('log', function(e) {console.log(e.value)});- recv('title', function(e) {document.title = e.value});- recv('redirect', function(e) {- if (e.value.length > 0) { window.location = e.value; }- });-- function swap(newModule) {- removeListeners(listeners);- var div = document.createElement('div');- var newElm = init(display, div, newModule, elm);- inputs = [];- // elm.send = newElm.send;- // elm.recv = newElm.recv;- // elm.swap = newElm.swap;- return newElm;- }-- var Module = {};- var reportAnyErrors = function() {};- try {- Module = module(elm);- } catch(e) {- var directions = "<br/> Open the developer console for more details."- Module.main = Elm.Text(elm).text('<code>' + e.message + directions + '</code>');- reportAnyErrors = function() { throw e; }- }- inputs = ElmRuntime.filterDeadInputs(inputs);- filterListeners(inputs, listeners);- if (display !== ElmRuntime.Display.NONE) {- var graphicsNode = initGraphics(elm, Module);- }- if (typeof moduleToReplace !== 'undefined') {- ElmRuntime.swap(moduleToReplace, elm);-- // rerender scene if graphics are enabled.- if (typeof graphicsNode !== 'undefined') {- graphicsNode.recv(0, true, 0);- }- }-- reportAnyErrors();- return { send:send, recv:recv, swap:swap };-};--function filterListeners(inputs, listeners) {- loop:- for (var i = listeners.length; i--; ) {- var listener = listeners[i];- for (var j = inputs.length; j--; ) {- if (listener.relevantInputs.indexOf(inputs[j].id) >= 0) {- continue loop;- }- }- listener.domNode.removeEventListener(listener.eventName, listener.func);- }-}--function removeListeners(listeners) {- for (var i = listeners.length; i--; ) {- var listener = listeners[i];- listener.domNode.removeEventListener(listener.eventName, listener.func);- }-}--function initGraphics(elm, Module) {- if (!('main' in Module))- throw new Error("'main' is missing! What do I display?!");-- var signalGraph = Module.main;-- // make sure the signal graph is actually a signal & extract the visual model- var Signal = Elm.Signal(elm);- if (!('recv' in signalGraph)) {- signalGraph = Signal.constant(signalGraph);- }- var currentScene = signalGraph.value;- - // Add the currentScene to the DOM- var Render = ElmRuntime.use(ElmRuntime.Render.Element);- elm.node.appendChild(Render.render(currentScene));- - // set up updates so that the DOM is adjusted as necessary.- function domUpdate(newScene, currentScene) {- ElmRuntime.draw(function(_) {- Render.update(elm.node.firstChild, currentScene, newScene);- if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();- });- return newScene;- }- var renderer = A3(Signal.foldp, F2(domUpdate), currentScene, signalGraph);-- // must check for resize after 'renderer' is created so- // that changes show up.- if (elm.Native.Window) elm.Native.Window.resizeIfNeeded();-- return renderer;-}--}());-(function() {-'use strict';--ElmRuntime.Display = { FULLSCREEN: 0, COMPONENT: 1, NONE: 2 };--ElmRuntime.counter = 0;-ElmRuntime.guid = function() { return ElmRuntime.counter++; }--ElmRuntime.use = function(M) {- if (typeof M === 'function') M = M();- return M;-};--function isAlive(input) {- if (!('defaultNumberOfKids' in input)) return true;- var len = input.kids.length;- if (len === 0) return false;- if (len > input.defaultNumberOfKids) return true;- var alive = false;- for (var i = len; i--; ) {- alive = alive || isAlive(input.kids[i]);- }- return alive;-}--ElmRuntime.filterDeadInputs = function(inputs) {- var temp = [];- for (var i = inputs.length; i--; ) {- if (isAlive(inputs[i])) temp.push(inputs[i]);- }- return temp;-};--// define the draw function-var vendors = ['ms', 'moz', 'webkit', 'o'];-for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {- window.requestAnimationFrame = window[vendors[i]+'RequestAnimationFrame'];- window.cancelAnimationFrame = window[vendors[i]+'CancelAnimationFrame'] ||- window[vendors[i]+'CancelRequestAnimationFrame'];-}--if (window.requestAnimationFrame && window.cancelAnimationFrame) {- var previous = 0;- ElmRuntime.draw = function(callback) {- window.cancelAnimationFrame(previous);- previous = window.requestAnimationFrame(callback);- };-} else {- ElmRuntime.draw = function(callback) { callback(); };-}--}());--ElmRuntime.Render.Collage = function() {-'use strict';--var Render = ElmRuntime.use(ElmRuntime.Render.Element);-var Matrix = Elm.Matrix2D({});-var Utils = ElmRuntime.use(ElmRuntime.Render.Utils);-var newElement = Utils.newElement,- extract = Utils.extract, fromList = Utils.fromList,- fromString = Utils.fromString, addTransform = Utils.addTransform;--function trace(ctx, path) {- var points = fromList(path);- var i = points.length - 1;- if (i <= 0) return;- ctx.moveTo(points[i]._0, points[i]._1);- while (i--) { ctx.lineTo(points[i]._0, points[i]._1); }- if (path.closed) {- i = points.length - 1;- ctx.lineTo(points[i]._0, points[i]._1);- }-}--function line(ctx,style,path) {- style.dashing.ctor === 'Nil' ? trace(ctx, path) : customLineHelp(ctx, style, path);- ctx.scale(1,-1);- ctx.stroke();-}--function customLineHelp(ctx, style, path) {- var points = fromList(path);- if (path.closed) points.push(points[0]);- var pattern = fromList(style.dashing);- var i = points.length - 1;- if (i <= 0) return;- var x0 = points[i]._0, y0 = points[i]._1;- var x1=0, y1=0, dx=0, dy=0, remaining=0, nx=0, ny=0;- var pindex = 0, plen = pattern.length;- var draw = true, segmentLength = pattern[0];- ctx.moveTo(x0,y0);- while (i--) {- x1 = points[i]._0; y1 = points[i]._1;- dx = x1 - x0; dy = y1 - y0;- remaining = Math.sqrt(dx * dx + dy * dy);- while (segmentLength <= remaining) {- x0 += dx * segmentLength / remaining;- y0 += dy * segmentLength / remaining;- ctx[draw ? 'lineTo' : 'moveTo'](x0, y0);- // update starting position- dx = x1 - x0; dy = y1 - y0;- remaining = Math.sqrt(dx * dx + dy * dy);- // update pattern- draw = !draw;- pindex = (pindex + 1) % plen;- segmentLength = pattern[pindex];- }- if (remaining > 0) {- ctx[draw ? 'lineTo' : 'moveTo'](x1, y1);- segmentLength -= remaining;- }- x0 = x1; y0 = y1;- }-}--function drawLine(ctx, style, path) {- ctx.lineWidth = style.width;- var cap = style.cap.ctor;- ctx.lineCap = cap === 'Flat' ? 'butt' :- cap === 'Round' ? 'round' : 'square';- var join = style.join.ctor;- ctx.lineJoin = join === 'Smooth' ? 'round' :- join === 'Sharp' ? 'miter' : 'bevel';- ctx.miterLimit = style.join._0 || 10;- ctx.strokeStyle = extract(style.color);- return line(ctx, style, path);-}--function texture(redo, ctx, src) {- var img = new Image();- img.src = fromString(src);- img.onload = redo;- return ctx.createPattern(img, 'repeat');-}--function gradient(ctx, grad) {- var g;- var stops = [];- if (grad.ctor === 'Linear') {- var p0 = grad._0, p1 = grad._1;- g = ctx.createLinearGradient(p0._0, -p0._1, p1._0, -p1._1);- stops = fromList(grad._2);- } else {- var p0 = grad._0, p2 = grad._2;- g = ctx.createRadialGradient(p0._0, -p0._1, grad._1, p2._0, -p2._1, grad._3);- stops = fromList(grad._4);- }- var len = stops.length;- for (var i = 0; i < len; ++i) {- var stop = stops[i];- g.addColorStop(stop._0, extract(stop._1));- }- return g;-}--function drawShape(redo, ctx, style, path) {- trace(ctx, path);- var sty = style.ctor;- ctx.fillStyle =- sty === 'Solid' ? extract(style._0) :- sty === 'Texture' ? texture(redo, ctx, style._0) : gradient(ctx, style._0);- ctx.scale(1,-1);- ctx.fill();-}--function drawImage(redo, ctx, form) {- var img = new Image();- img.onload = redo;- img.src = fromString(form._3);- var w = form._0,- h = form._1,- pos = form._2,- srcX = pos._0,- srcY = pos._1,- srcW = w,- srcH = h,- destX = -w/2,- destY = -h/2,- destW = w,- destH = h;-- ctx.scale(1,-1);- ctx.drawImage(img, srcX, srcY, srcW, srcH, destX, destY, destW, destH);-}--function renderForm(redo, ctx, form) {- ctx.save();- var x = form.x, y = form.y, theta = form.theta, scale = form.scale;- if (x !== 0 || y !== 0) ctx.translate(x, y);- if (theta !== 0) ctx.rotate(theta);- if (scale !== 1) ctx.scale(scale,scale);- if (form.alpha !== 1) ctx.globalAlpha = ctx.globalAlpha * form.alpha;- ctx.beginPath();- var f = form.form;- switch(f.ctor) {- case 'FPath' : drawLine(ctx, f._0, f._1); break;- case 'FImage': drawImage(redo, ctx, f); break;- case 'FShape':- if (f._0.ctor === 'Left') {- f._1.closed = true;- drawLine(ctx, f._0._0, f._1);- } else {- drawShape(redo, ctx, f._0._0, f._1);- }- break;- }- ctx.restore();-}--function formToMatrix(form) {- var scale = form.scale;- var matrix = A6( Matrix.matrix, scale, 0, 0, scale, form.x, form.y );-- var theta = form.theta- if (theta !== 0)- matrix = A2( Matrix.multiply, matrix, Matrix.rotation(theta) );-- return matrix;-}--function makeTransform(w, h, form, matrices) {- var props = form.form._0.props;- var m = A6( Matrix.matrix, 1, 0, 0, 1,- (w - props.width)/2,- (h - props.height)/2 );- var len = matrices.length;- for (var i = 0; i < len; ++i) { m = A2( Matrix.multiply, m, matrices[i] ); }- m = A2( Matrix.multiply, m, formToMatrix(form) );-- return 'matrix(' + m[0] + ',' + m[3] + ',' +- (-m[1]) + ',' + (-m[4]) + ',' +- m[2] + ',' + m[5] + ')';-}--function stepperHelp(list) {- var arr = fromList(list);- var i = 0;- function peekNext() {- return i < arr.length ? arr[i].form.ctor : '';- }- // assumes that there is a next element- function next() {- var out = arr[i];- ++i;- return out;- }- return { peekNext:peekNext, next:next };-}--function stepper(forms) {- var ps = [stepperHelp(forms)];- var matrices = [];- var alphas = [];- function peekNext() {- var len = ps.length;- var formType = '';- for (var i = 0; i < len; ++i ) {- if (formType = ps[i].peekNext()) return formType;- }- return '';- }- // assumes that there is a next element- function next(ctx) {- while (!ps[0].peekNext()) {- ps.shift();- matrices.pop();- alphas.shift();- if (ctx) { ctx.restore(); }- }- var out = ps[0].next();- var f = out.form;- if (f.ctor === 'FGroup') {- ps.unshift(stepperHelp(f._1));- var m = A2(Matrix.multiply, f._0, formToMatrix(out));- ctx.save();- ctx.transform(m[0], m[3], m[1], m[4], m[2], m[5]);- matrices.push(m);-- var alpha = (alphas[0] || 1) * out.alpha;- alphas.unshift(alpha);- ctx.globalAlpha = alpha;- }- return out;- }- function transforms() { return matrices; }- function alpha() { return alphas[0] || 1; }- return { peekNext:peekNext, next:next, transforms:transforms, alpha:alpha };-}--function makeCanvas(w,h) {- var canvas = newElement('canvas');- canvas.style.width = w + 'px';- canvas.style.height = h + 'px';- canvas.style.display = "block";- canvas.style.position = "absolute";- canvas.width = w;- canvas.height = h;- return canvas;-}--function render(model) {- var div = newElement('div');- update(div, model, model);- return div;-}--function updateTracker(w,h,div) {- var kids = div.childNodes;- var i = 0;- function transform(transforms, ctx) {- ctx.translate(w/2, h/2);- ctx.scale(1,-1);- var len = transforms.length;- for (var i = 0; i < len; ++i) {- var m = transforms[i];- ctx.save();- ctx.transform(m[0], m[3], m[1], m[4], m[2], m[5]);- }- return ctx;- }- function getContext(transforms) {- while (i < kids.length) {- var node = kids[i];- if (node.getContext) {- node.width = w;- node.height = h;- node.style.width = w + 'px';- node.style.height = h + 'px';- ++i;- return transform(transforms, node.getContext('2d'));- }- div.removeChild(node);- }- var canvas = makeCanvas(w,h);- div.appendChild(canvas);- // we have added a new node, so we must step our position- ++i;- return transform(transforms, canvas.getContext('2d'));- }- function element(matrices, alpha, form) {- var container = kids[i];- if (!container || container.getContext) {- container = newElement('div');- container.style.overflow = 'hidden';- container.style.position = 'absolute';- addTransform(container.style, 'scaleY(-1)');- - var kid = kids[i];- kid ? div.insertBefore(container, kid)- : div.appendChild(container);- }- // we have added a new node, so we must step our position- ++i;-- container.style.width = w + 'px';- container.style.height = h + 'px';- container.style.opacity = alpha * form.alpha;-- var elem = form.form._0;- var node = container.firstChild;- if (node) {- Render.update(node, node.oldElement, elem);- node = container.firstChild;- } else {- node = Render.render(elem);- container.appendChild(node);- }- node.oldElement = elem;- addTransform(node.style, makeTransform(w, h, form, matrices));- }- function clearRest() {- while (i < kids.length) {- div.removeChild(kids[i]);- }- }- return { getContext:getContext, element:element, clearRest:clearRest };-}---function update(div, _, model) {- var w = model.w;- var h = model.h;- div.style.width = w + 'px';- div.style.height = h + 'px';- if (model.forms.ctor === 'Nil') {- while (div.hasChildNodes()) {- div.removeChild(div.lastChild);- }- }- var stpr = stepper(model.forms);- var tracker = updateTracker(w,h,div);- var ctx = null;- var formType = '';-- while (formType = stpr.peekNext()) {- if (ctx === null && formType !== 'FElement') {- ctx = tracker.getContext(stpr.transforms());- ctx.globalAlpha = stpr.alpha();- }- var form = stpr.next(ctx);- if (formType === 'FElement') {- tracker.element(stpr.transforms(), stpr.alpha(), form);- ctx = null;- } else if (formType !== 'FGroup') {- renderForm(function() { update(div, model, model); }, ctx, form);- }- }- tracker.clearRest();- return false;-}--return { render:render, update:update };--};--ElmRuntime.Render.Element = function() {-'use strict';--var Utils = ElmRuntime.use(ElmRuntime.Render.Utils);-var newElement = Utils.newElement, extract = Utils.extract,- addTransform = Utils.addTransform, removeTransform = Utils.removeTransform,- fromList = Utils.fromList, eq = Utils.eq;--function setProps(props, e) {- e.style.width = (props.width |0) + 'px';- e.style.height = (props.height|0) + 'px';- if (props.opacity !== 1) { e.style.opacity = props.opacity; }- if (props.color.ctor === 'Just') {- e.style.backgroundColor = extract(props.color._0);- }- if (props.tag !== '') { e.id = props.tag; }- if (props.href !== '') {- var a = newElement('a');- a.href = props.href;- a.style.width = '100%';- a.style.height = '100%';- a.style.top = 0;- a.style.left = 0;- a.style.display = 'block';- a.style.position = 'absolute';- e.style.position = 'relative';- e.appendChild(a);- }- if (props.hover.ctor !== '_Tuple0') {- var overCount = 0;- e.addEventListener('mouseover', function() {- if (overCount++ > 0) return;- props.hover(true);- });- e.addEventListener('mouseout', function(evt) {- if (e.contains(evt.toElement || evt.relatedTarget)) return;- overCount = 0;- props.hover(false);- });- }- return e;-}--function image(props, img) {- switch (img._0.ctor) {- case 'Plain': return plainImage(img._3);- case 'Fitted': return fittedImage(props.width, props.height, img._3);- case 'Cropped': return croppedImage(img,props.width,props.height,img._3);- case 'Tiled': return tiledImage(img._3);- }-}--function plainImage(src) {- var img = newElement('img');- img.src = src;- img.name = src;- img.style.display = "block";- return img;-}--function tiledImage(src) {- var div = newElement('div');- div.style.backgroundImage = 'url(' + src + ')';- return div;-}--function fittedImage(w, h, src) {- var div = newElement('div');- div.style.background = 'url(' + src + ') no-repeat center';- div.style.webkitBackgroundSize = 'cover';- div.style.MozBackgroundSize = 'cover';- div.style.OBackgroundSize = 'cover';- div.style.backgroundSize = 'cover';- return div;-}--function croppedImage(elem, w, h, src) {- var pos = elem._0._0;- var e = newElement('div');- e.style.overflow = "hidden";-- var img = newElement('img');- img.onload = function() {- var sw = w / elem._1, sh = h / elem._2;- img.style.width = ((this.width * sw)|0) + 'px';- img.style.height = ((this.height * sh)|0) + 'px';- img.style.marginLeft = ((- pos._0 * sw)|0) + 'px';- img.style.marginTop = ((- pos._1 * sh)|0) + 'px';- };- img.src = src;- img.name = src;- e.appendChild(img);- return e;-}--function goIn(e) { e.style.position = 'absolute'; return e; }-function goDown(e) { return e }-function goRight(e) { e.style.styleFloat = e.style.cssFloat = "left"; return e; }-function flowWith(f, array) {- var container = newElement('div');- for (var i = array.length; i--; ) {- container.appendChild(f(render(array[i])));- }- return container;-}--function flow(dir,elist) {- var array = fromList(elist);- switch(dir.ctor) {- case "DDown": array.reverse();- case "DUp": return flowWith(goDown,array);- case "DRight": array.reverse();- case "DLeft": return flowWith(goRight,array);- case "DOut": array.reverse();- case "DIn": return flowWith(goIn,array);- }-}--function toPos(pos) {- switch(pos.ctor) {- case "Absolute": return pos._0 + "px";- case "Relative": return (pos._0 * 100) + "%";- }-}--function setPos(pos,w,h,e) {- e.style.position = 'absolute';- e.style.margin = 'auto';- var transform = '';- switch(pos.horizontal.ctor) {- case 'P': e.style.right = toPos(pos.x); break;- case 'Z': transform = 'translateX(' + ((-w/2)|0) + 'px) ';- case 'N': e.style.left = toPos(pos.x); break;- }- switch(pos.vertical.ctor) {- case 'N': e.style.bottom = toPos(pos.y); break;- case 'Z': transform += 'translateY(' + ((-h/2)|0) + 'px)';- case 'P': e.style.top = toPos(pos.y); break;- }- if (transform !== '') addTransform(e.style, transform);- return e;-}--function container(pos,elem) {- var e = render(elem);- setPos(pos, elem.props.width, elem.props.height, e);- var div = newElement('div');- div.style.position = 'relative';- div.style.overflow = 'hidden';- div.appendChild(e);- return div;-}--function rawHtml(html) {- var e = newElement('div');- e.innerHTML = html;- return e;-}--function render(elem) { return setProps(elem.props, makeElement(elem)); }-function makeElement(e) {- var elem = e.element;- switch(elem.ctor) {- case 'Image': return image(e.props, elem);- case 'Flow': return flow(elem._0, elem._1);- case 'Container': return container(elem._0, elem._1);- case 'Spacer': return newElement('div');- case 'RawHtml': return rawHtml(elem._0);- case 'Custom': return elem.render(elem.model);- }-}--function update(node, curr, next) {- if (node.tagName === 'A') { node = node.firstChild; }- if (curr.props.id === next.props.id) return updateProps(node, curr, next);- if (curr.element.ctor !== next.element.ctor) {- node.parentNode.replaceChild(render(next),node);- return true;- }- var nextE = next.element, currE = curr.element;- switch(nextE.ctor) {- case "Spacer": break;- case "RawHtml":- if (nextE._0 !== currE._0) node.innerHTML = nextE._0;- break;- case "Image":- if (nextE._0.ctor === 'Plain') {- if (nextE._3 !== currE._3) node.src = nextE._3;- } else if (!eq(nextE,currE) ||- next.props.width !== curr.props.width ||- next.props.height !== curr.props.height) {- node.parentNode.replaceChild(render(next),node);- return true;- }- break;- case "Flow":- var arr = fromList(nextE._1);- for (var i = arr.length; i--; ) { arr[i] = arr[i].element.ctor; }- if (nextE._0.ctor !== currE._0.ctor) {- node.parentNode.replaceChild(render(next),node);- return true;- }- var nexts = fromList(nextE._1);- var kids = node.childNodes;- if (nexts.length !== kids.length) {- node.parentNode.replaceChild(render(next),node);- return true;- }- var currs = fromList(currE._1);- var goDir = function(x) { return x; };- switch(nextE._0.ctor) {- case "DDown": case "DUp": goDir = goDown; break;- case "DRight": case "DLeft": goDir = goRight; break;- case "DOut": case "DIn": goDir = goIn; break;- }- for (var i = kids.length; i-- ;) {- update(kids[i],currs[i],nexts[i]);- goDir(kids[i]);- }- break;- case "Container":- var inner = node.firstChild;- if (!update(inner, currE._1, nextE._1)) {- if (nextE._0.horizontal.ctor !== currE._0.horizontal.ctor) {- inner.style.left = inner.style.right = 'none';- removeTransform(inner.style);- }- if (nextE._0.vertical.ctor !== currE._0.vertical.ctor) {- inner.style.top = inner.style.bottom = 'none';- removeTransform(inner.style);- }- }- setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, inner);- break;- case "Custom":- if (currE.type === nextE.type) {- var done = nextE.update(node, currE.model, nextE.model);- if (done) return;- } else {- return node.parentNode.replaceChild(render(next), node);- }- }- updateProps(node, curr, next);-}--function updateProps(node, curr, next) {- var props = next.props, currP = curr.props, e = node;- if (props.width !== currP.width) e.style.width = (props.width |0) + 'px';- if (props.height !== currP.height) e.style.height = (props.height|0) + 'px';- if (props.opacity !== 1 && props.opacity !== currP.opacity) {- e.style.opacity = props.opacity;- }- var nextColor = (props.color.ctor === 'Just' ?- extract(props.color._0) : 'transparent');- if (e.style.backgroundColor !== nextColor) {- e.style.backgroundColor = nextColor;- }- if (props.tag !== currP.tag) { e.id = props.tag; }- if (props.href !== currP.href) {- if (currP.href === '') {- var a = newElement('a');- a.href = props.href;- a.style.width = '100%';- a.style.height = '100%';- a.style.top = 0;- a.style.left = 0;- a.style.display = 'block';- a.style.position = 'absolute';- e.style.position = 'relative';- e.appendChild(a);- } else {- node.lastNode.href = props.href;- }- }-}--return { render:render, update:update };--};-ElmRuntime.Render.Utils = function() {-'use strict';--function newElement(elementType) {- var e = document.createElement(elementType); - e.style.padding = "0";- e.style.margin = "0";- return e;-}--function addTo(container, elem) {- container.appendChild(elem);-}--function extract(c) {- if (c._3 === 1) { return 'rgb(' + c._0 + ',' + c._1 + ',' + c._2 + ')'; }- return 'rgba(' + c._0 + ',' + c._1 + ',' + c._2 + ',' + c._3 + ')';-}--function addTransform(style, trans) {- style.transform = trans;- style.msTransform = trans;- style.MozTransform = trans;- style.webkitTransform = trans;- style.OTransform = trans;-}--function removeTransform(style) {- style.transform = 'none';- style.msTransform = 'none';- style.MozTransform = 'none';- style.webkitTransform = 'none';- style.OTransform = 'none';-}--var List = Elm.Native.List({});--return {addTo:addTo,- newElement:newElement,- extract : extract,- fromList: List.toArray,- fromString: function(s) { return List.toArray(s).join(''); },- toString: List.fromArray,- eq: Elm.Native.Utils({}).eq,+var Elm = {}; Elm.Native = {}; Elm.Native.Graphics = {};+var ElmRuntime = {}; ElmRuntime.Render = {};++Elm.Native.Basics = {};+Elm.Native.Basics.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Basics = elm.Native.Basics || {};+ if (elm.Native.Basics.values) return elm.Native.Basics.values;++ var JS = Elm.Native.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ function div(a,b) { return (a/b)|0; }+ function rem(a,b) { return a % b; }+ var mod = Utils.mod;+ function abs(x) { return x < 0 ? -x : x; }+ function logBase(base,n) { return Math.log(n) / Math.log(base); }+ function min(a,b) { return Utils.cmp(a,b) < 0 ? a : b; }+ function max(a,b) { return Utils.cmp(a,b) > 0 ? a : b; }+ function clamp(lo,hi,n) {+ return Utils.cmp(n,lo) < 0 ? lo : Utils.cmp(n,hi) > 0 ? hi : n; }+ function xor(a,b) { return a !== b; }+ function not(b) { return !b; }++ function truncate(n) { return n|0; }++ function curry(f,a,b) { return f(Utils.Tuple2(a,b)); }+ function uncurry(f,v) { return A2(f,v._0,v._1); }+ function fst(t) { return t._0; }+ function snd(t) { return t._1; }++ var basics = {+ div:F2(div),+ rem:F2(rem),+ mod:mod,++ pi:Math.PI,+ e:Math.e,+ cos:Math.cos,+ sin:Math.sin,+ tan:Math.tan,+ acos:Math.acos,+ asin:Math.asin,+ atan:Math.atan,+ atan2:F2(Math.atan2),++ sqrt:Math.sqrt,+ abs:abs,+ logBase:F2(logBase),+ min:F2(min),+ max:F2(max),+ clamp:F3(clamp),+ compare:Utils.compare,++ xor:F2(xor),+ not:not,++ truncate:truncate,+ ceiling:Math.ceil,+ floor:Math.floor,+ round:Math.round,+ toFloat:function(x) { return x; },++ curry:F3(curry),+ uncurry:F2(uncurry),+ fst:fst,+ snd:snd+ };++ return elm.Native.Basics.values = basics;+};+Elm.Native.Char = {};+Elm.Native.Char.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Char = elm.Native.Char || {};+ if (elm.Native.Char.values) return elm.Native.Char.values;++ function isBetween(lo,hi) { return function(chr) {+ var c = chr.charCodeAt(0);+ return lo <= c && c <= hi;+ };+ }+ var isDigit = isBetween('0'.charCodeAt(0),'9'.charCodeAt(0));+ var chk1 = isBetween('a'.charCodeAt(0),'f'.charCodeAt(0));+ var chk2 = isBetween('A'.charCodeAt(0),'F'.charCodeAt(0));++ return elm.Native.Char.values = {+ fromCode : function(c) { return String.fromCharCode(c); },+ toCode : function(c) { return c.toUpperCase().charCodeAt(0); },+ toUpper : function(c) { return c.toUpperCase(); },+ toLower : function(c) { return c.toLowerCase(); },+ toLocaleUpper : function(c) { return c.toLocaleUpperCase(); },+ toLocaleLower : function(c) { return c.toLocaleLowerCase(); },+ isLower : isBetween('a'.charCodeAt(0),'z'.charCodeAt(0)),+ isUpper : isBetween('A'.charCodeAt(0),'Z'.charCodeAt(0)),+ isDigit : isDigit,+ isOctDigit : isBetween('0'.charCodeAt(0),'7'.charCodeAt(0)),+ isHexDigit : function(c) { return isDigit(c) || chk1(c) || chk2(c); }+ };+};+Elm.Native.Color = {};+Elm.Native.Color.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Color = elm.Native.Color || {};+ if (elm.Native.Color.values) return elm.Native.Color.values;++ var Utils = Elm.Native.Utils.make(elm);++ function complement(rgb) {+ var hsv = toHSV(rgb);+ hsv.hue = (hsv.hue + 180) % 360;+ return toRGB(hsv);+ }++ function hsva(h,s,v,a) {+ var degree = A2(Utils.mod, h * 180 / Math.PI, 360);+ var clr = toRGB({hue:degree, saturation:s, value:v});+ clr._3 = a;+ return clr;+ }++ function hsv(h,s,v) {+ var degree = A2(Utils.mod, h * 180 / Math.PI, 360);+ return toRGB({hue:degree, saturation:s, value:v});+ }++ function toHSV(rgb) {+ var hsv = {};+ var r = rgb._0 / 255.0, g = rgb._1 / 255.0, b = rgb._2 / 255.0;+ var M = Math.max(r,g,b);+ var m = Math.min(r,g,b);+ var c = M - m;++ var h = 0;+ if (c === 0) { h = 0; }+ else if (M === r) { h = ((g - b) / c) % 6; }+ else if (M === g) { h = ((b - r) / c) + 2; }+ else if (M === b) { h = ((r - g) / c) + 4; }+ h *= 60;++ return { value : M, hue : h, saturation : (M === 0 ? 0 : c / M) };+ }++ function between(lo,hi,x) { return lo <= x && x < hi; }+ function norm(n) { return Math.round(n*255); }++ function toRGB(hsv) {+ var c = hsv.value * hsv.saturation;+ var hue = hsv.hue / 60;+ var x = c * (1 - Math.abs((hue % 2) - 1));+ var r = 0, g = 0, b = 0;+ if (between(0,1,hue)) { r = c; g = x; b = 0; }+ else if (between(1,2,hue)) { r = x; g = c; b = 0; }+ else if (between(2,3,hue)) { r = 0; g = c; b = x; }+ else if (between(3,4,hue)) { r = 0; g = x; b = c; }+ else if (between(4,5,hue)) { r = x; g = 0; b = c; }+ else if (between(5,6,hue)) { r = c; g = 0; b = x; }++ var m = hsv.value - c;+ return { ctor:"Color", _0:norm(r+m), _1:norm(g+m), _2:norm(b+m), _3:1 };+ }++ return elm.Native.Color.values = {+ hsva:F4(hsva),+ hsv:F3(hsv),+ complement:complement+ };++};Elm.Native.Date = {};+Elm.Native.Date.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Date = elm.Native.Date || {};+ if (elm.Native.Date.values) return elm.Native.Date.values;++ var JS = Elm.JavaScript.make(elm);+ var Maybe = Elm.Maybe.make(elm);++ function dateNow() { return new window.Date; }+ function readDate(str) {+ var d = new window.Date(JS.fromString(str));+ if (isNaN(d.getTime())) return Maybe.Nothing;+ return Maybe.Just(d);+ }++ var dayTable = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];+ var monthTable = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; ++ return elm.Native.Date.values = {+ read : readDate,+ year : function(d) { return d.getFullYear(); },+ month : function(d) { return { ctor:monthTable[d.getMonth()] }; },+ day : function(d) { return d.getDate(); },+ hour : function(d) { return d.getHours(); },+ minute : function(d) { return d.getMinutes(); },+ second : function(d) { return d.getSeconds(); },+ toTime : function(d) { return d.getTime(); },+ dayOfWeek : function(d) { return { ctor:dayTable[d.getDay()] }; }+ };++};+Elm.Native.Error = {};+Elm.Native.Error.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Error = elm.Native.Error || {};+ if (elm.Native.Error.values) return elm.Native.Error.values;++ var fromString = Elm.Native.JavaScript.make(elm).fromString;++ function indent(lines) {+ var msg = '';+ for (var i = 0; i < lines.length; ++i) {+ msg += '<br/> ' + lines[i];+ }+ return msg;+ }++ function Case(moduleName, span) { + var msg = indent(['Non-exhaustive pattern match in case-expression.',+ 'Make sure your patterns cover every case!']);+ throw new Error('Runtime error in module ' + moduleName + ' (' + span + '):' + msg);+ }++ function If(moduleName, span) { + var msg = indent(['Non-exhaustive pattern match in multi-way-if expression.',+ 'It is best to use \'otherwise\' as the last branch of multi-way-if.']);+ throw new Error('Runtime error in module ' + moduleName + ' (' + span + '):' + msg);+ }++ function raise(str) { throw new Error(fromString(str)); }++ return elm.Native.Error.values = { Case: Case, If: If, raise: raise };+};+function F2(fun) {+ function wrapper(a) { return function(b) { return fun(a,b) } }+ wrapper.arity = 2;+ wrapper.func = fun;+ return wrapper;+}++function F3(fun) {+ function wrapper(a) {+ return function(b) { return function(c) { return fun(a,b,c) }}+ }+ wrapper.arity = 3;+ wrapper.func = fun;+ return wrapper;+}++function F4(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return fun(a,b,c,d) }}}+ }+ wrapper.arity = 4;+ wrapper.func = fun;+ return wrapper;+}++function F5(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return function(e) { return fun(a,b,c,d,e) }}}}+ }+ wrapper.arity = 5;+ wrapper.func = fun;+ return wrapper;+}++function F6(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return function(e) { return function(f) {+ return fun(a,b,c,d,e,f) }}}}}+ }+ wrapper.arity = 6;+ wrapper.func = fun;+ return wrapper;+}++function F7(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return function(e) { return function(f) {+ return function(g) { return fun(a,b,c,d,e,f,g) }}}}}}+ }+ wrapper.arity = 7;+ wrapper.func = fun;+ return wrapper;+}++function F8(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return function(e) { return function(f) {+ return function(g) { return function(h) {return fun(a,b,c,d,e,f,g,h)}}}}}}}+ }+ wrapper.arity = 8;+ wrapper.func = fun;+ return wrapper;+}++function F9(fun) {+ function wrapper(a) { return function(b) { return function(c) {+ return function(d) { return function(e) { return function(f) {+ return function(g) { return function(h) { return function(i) {+ return fun(a,b,c,d,e,f,g,h,i) }}}}}}}}+ }+ wrapper.arity = 9;+ wrapper.func = fun;+ return wrapper;+}++function A2(fun,a,b) {+ return fun.arity === 2 ? fun.func(a,b) : fun(a)(b);+}+function A3(fun,a,b,c) {+ return fun.arity === 3 ? fun.func(a,b,c) : fun(a)(b)(c);+}+function A4(fun,a,b,c,d) {+ return fun.arity === 4 ? fun.func(a,b,c,d) : fun(a)(b)(c)(d);+}+function A5(fun,a,b,c,d,e) {+ return fun.arity === 5 ? fun.func(a,b,c,d,e) : fun(a)(b)(c)(d)(e);+}+function A6(fun,a,b,c,d,e,f) {+ return fun.arity === 6 ? fun.func(a,b,c,d,e,f) : fun(a)(b)(c)(d)(e)(f);+}+function A7(fun,a,b,c,d,e,f,g) {+ return fun.arity === 7 ? fun.func(a,b,c,d,e,f,g) : fun(a)(b)(c)(d)(e)(f)(g);+}+function A8(fun,a,b,c,d,e,f,g,h) {+ return fun.arity === 8 ? fun.func(a,b,c,d,e,f,g,h) : fun(a)(b)(c)(d)(e)(f)(g)(h);+}+function A9(fun,a,b,c,d,e,f,g,h,i) {+ return fun.arity === 9 ? fun.func(a,b,c,d,e,f,g,h,i)+ : fun(a)(b)(c)(d)(e)(f)(g)(h)(i);+}+Elm.Native.JavaScript = {};+Elm.Native.JavaScript.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.JavaScript = elm.Native.JavaScript || {};+ if (elm.Native.JavaScript.values) return elm.Native.JavaScript.values;++ var List = Elm.Native.List.make(elm);+ var Render = ElmRuntime.use(ElmRuntime.Render.Element);++ function fromJS(v) {+ var type = typeof v;+ if (type === 'number' ) return v;+ if (type === 'boolean') return v;+ if (type === 'string' ) return v;+ if (v instanceof Array) {+ var arr = [];+ var len = v.length;+ for (var i = 0; i < len; ++i) {+ var x = fromJS(v[i]);+ if (x !== null) arr.push(x);+ }+ return List.fromArray(arr);+ }+ if (type === 'object') {+ var rec = { _:{} };+ for (var f in v) {+ var x = fromJS(v[f]);+ if (x !== null) rec[f] = x;+ }+ return rec;+ }+ return null;+ }++ function toJS(v) {+ var type = typeof v;+ if (type === 'number' || type === 'boolean') return v;+ if (type === 'object' && '_' in v) {+ var obj = {};+ for (var k in v) {+ var x = toJS(v[k]);+ if (x !== null) obj[k] = x;+ }+ return obj;+ }+ if (type === 'object' && (v.ctor === '::' || v.ctor === '[]')) {+ var array = List.toArray(v);+ for (var i = array.length; i--; ) {+ array[i] = toJS(array[i]);+ }+ return array;+ }+ return null;+ }++ function fromRecord(r) {+ if (typeof r === 'object' && '_' in r) {+ return toJS(r);+ }+ throw new Error("'fromRecord' must be called on a record.");+ }++ function id(n) { return n; }++ function toElement(w,h,domNode) {+ return A3( newElement, w, h, {+ ctor: 'Custom',+ type: 'DomNode',+ render: function(node) { return node; },+ update: function(node,oldNode,newNode) {+ if (node === newNode) return;+ node.parentNode.replaceChild(newNode, node);+ },+ model: domNode+ });+ }++ function fromElement(element) {+ return Render.render(element);+ }++ return elm.Native.JavaScript.values = {+ toInt : function(n) { return n|0; },+ toFloat : function(n) { return +n; },+ toBool : id,+ toString : id,+ toList : List.fromArray,+ fromString : id,+ fromList : List.toArray,+ fromInt : id,+ fromFloat : id,+ fromBool : id,++ toElement : toElement,+ fromElement : fromElement,+ toRecord : fromJS,+ fromRecord : fromRecord+ };++};+Elm.Native.Json = {};+Elm.Native.Json.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Json = elm.Native.Json || {};+ if (elm.Native.Json.values) return elm.Native.Json.values;++ var Maybe = Elm.Maybe.make(elm);+ var Dict = Elm.Dict.make(elm);+ var List = Elm.List.make(elm);+ var JS = Elm.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ function fromValue(v) {+ switch (v.ctor) {+ case 'Null' : return null;+ case 'String' : return JS.fromString(v._0);+ case 'Object' :+ var obj = {};+ var array = JS.fromList(Dict.toList(v._0));+ for (var i = array.length; i--; ) {+ obj[JS.fromString(array[i]._0)] = fromValue(array[i]._1);+ }+ return obj;+ case 'Array' :+ var array = JS.fromList(v._0);+ for (var i = array.length; i--; ) {+ array[i] = fromValue(array[i]);+ }+ return array;+ default :+ return v._0;+ }+ }++ function toPrettyJSString(sep, obj) {+ return JSON.stringify(fromValue(obj), null, JS.fromString(sep));+ }++ function toValue(v) {+ switch (typeof v) {+ case 'string' : return { ctor:"String", _0: JS.toString(v) };+ case 'number' : return { ctor:"Number", _0: JS.toFloat(v) };+ case 'boolean': return { ctor:"Bool" , _0: JS.toBool(v) };+ case 'object' :+ if (v === null) return { ctor:"Null" };+ if (v instanceof Array) {+ for (var i = v.length; i--; ) { v[i] = toValue(v[i]); }+ return { ctor:"Array", _0: JS.toList(v) };+ }+ var array = [];+ for (var k in v) array.push(Utils.Tuple2(JS.toString(k), toValue(v[k])));+ return { ctor:"Object", _0: Dict.fromList(JS.toList(array)) };+ }+ }++ function fromJSString(str) {+ try {+ return Maybe.Just(toValue(JSON.parse(str)));+ } catch (e) {+ return Maybe.Nothing;+ }+ }++ return elm.Native.Json.values = {+ toJSString : F2(toPrettyJSString),+ fromJSString : fromJSString,+ toJSObject : fromValue,+ fromJSObject : toValue+ };++};+Elm.Native.List = {};+Elm.Native.List.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.List = elm.Native.List || {};+ if (elm.Native.List.values) return elm.Native.List.values;+ if ('values' in Elm.Native.List)+ return elm.Native.List.values = Elm.Native.List.values;++ var Utils = Elm.Native.Utils.make(elm);++ // TODO: Improve Nil handling+ // We can change places like: if (xs.ctor === '[]') ... to if (xs === Nil) ...+ // but only if we're confident Nil can only be defined once.+ // Currently (27Mar2013) each module can have different instantiations, so multiple Nil objects can exist+ // (and if they're used interchangeably then direct object comparison fails where ctor doesn't).+ // So, this can only be fixed when modules initialisation is also fixed.+ // The performance overhead of the .ctor calls is 5-10% according to jsperf (depending on fn + list size)+ // (on firefox 19)++ var Nil = { ctor:'[]' };++ // using freeze for every cons would be nice but is a huge (9x on firefox 19)+ // performance penalty+ function Cons(hd,tl) { return { ctor:"::", _0:hd, _1:tl }; }++ function throwError(f) {+ throw new Error("Function '" + f + "' expects a non-empty list!");+ }++ function toArray(xs) {+ var out = [];+ while (xs.ctor !== '[]') {+ out.push(xs._0);+ xs = xs._1;+ }+ return out;+ }++ function fromArray(arr) {+ var out = Nil;+ for (var i = arr.length; i--; ) {+ out = Cons(arr[i], out);+ }+ return out;+ }++ function range(lo,hi) {+ var lst = Nil;+ if (lo <= hi) {+ do { lst = Cons(hi,lst) } while (hi-->lo);+ }+ return lst+ }++ function append(xs,ys) {+ if (xs.isText) return Utils.txt(xs.concat(ys));+ if (typeof xs === "string") return xs.concat(ys);+ if (xs.ctor === '[]') { return ys; }+ var root = Cons(xs._0, Nil);+ var curr = root;+ xs = xs._1;+ while (xs.ctor !== '[]') {+ curr._1 = Cons(xs._0, Nil);+ xs = xs._1;+ curr = curr._1;+ }+ curr._1 = ys;+ return root;+ }++ function head(v) { return v.ctor === '[]' ? throwError('head') : v._0; }+ function tail(v) { return v.ctor === '[]' ? throwError('tail') : v._1; }++ function last(xs) {+ if (xs.ctor === '[]') { throwError('last'); }+ var out = xs._0;+ while (xs.ctor !== '[]') {+ out = xs._0;+ xs = xs._1;+ }+ return out;+ }++ function map(f, xs) {+ var arr = [];+ while (xs.ctor !== '[]') {+ arr.push(f(xs._0));+ xs = xs._1;+ }+ return fromArray(arr);+ }++ // f defined similarly for both foldl and foldr (NB: different from Haskell)+ // ie, foldl : (a -> b -> b) -> b -> [a] -> b+ function foldl(f, b, xs) {+ var acc = b;+ while (xs.ctor !== '[]') {+ acc = A2(f, xs._0, acc);+ xs = xs._1;+ }+ return acc;+ }++ function foldr(f, b, xs) {+ var arr = toArray(xs);+ var acc = b;+ for (var i = arr.length; i--; ) {+ acc = A2(f, arr[i], acc);+ }+ return acc;+ }++ function foldl1(f, xs) {+ return xs.ctor === '[]' ? throwError('foldl1') : foldl(f, xs._0, xs._1);+ }++ function foldr1(f, xs) {+ if (xs.ctor === '[]') { throwError('foldr1'); }+ var arr = toArray(xs);+ var acc = arr.pop();+ for (var i = arr.length; i--; ) {+ acc = A2(f, arr[i], acc);+ }+ return acc;+ }++ function scanl(f, b, xs) {+ var arr = toArray(xs);+ arr.unshift(b);+ var len = arr.length;+ for (var i = 1; i < len; ++i) {+ arr[i] = A2(f, arr[i], arr[i-1]);+ }+ return fromArray(arr);+ }++ function scanl1(f, xs) {+ return xs.ctor === '[]' ? throwError('scanl1') : scanl(f, xs._0, xs._1);+ }++ function filter(pred, xs) {+ var arr = [];+ while (xs.ctor !== '[]') {+ if (pred(xs._0)) { arr.push(xs._0); }+ xs = xs._1;+ }+ return fromArray(arr);+ }++ function length(xs) {+ var out = 0;+ while (xs.ctor !== '[]') {+ out += 1;+ xs = xs._1;+ }+ return out;+ }++ function member(x, xs) {+ while (xs.ctor !== '[]') {+ if (Utils.eq(x,xs._0)) return true;+ xs = xs._1;+ }+ return false;+ }++ function reverse(xs) { return fromArray(toArray(xs).reverse()); }++ function concat(xss) {+ if (xss.ctor === '[]') return xss;+ var arr = toArray(xss);+ var xs = arr[arr.length-1];+ for (var i = arr.length-1; i--; ) {+ xs = append(arr[i], xs);+ }+ return xs;+ }++ function all(pred, xs) {+ while (xs.ctor !== '[]') {+ if (!pred(xs._0)) return false;+ xs = xs._1;+ }+ return true;+ }++ function any(pred, xs) {+ while (xs.ctor !== '[]') {+ if (pred(xs._0)) return true;+ xs = xs._1;+ }+ return false;+ }++ function zipWith(f, xs, ys) {+ var arr = [];+ while (xs.ctor !== '[]' && ys.ctor !== '[]') {+ arr.push(A2(f, xs._0, ys._0));+ xs = xs._1;+ ys = ys._1;+ }+ return fromArray(arr);+ }++ function zip(xs, ys) {+ var arr = [];+ while (xs.ctor !== '[]' && ys.ctor !== '[]') {+ arr.push(Utils.Tuple2(xs._0, ys._0));+ xs = xs._1;+ ys = ys._1;+ }+ return fromArray(arr);+ }++ function sort(xs) {+ function cmp(a,b) {+ var ord = Utils.compare(a,b).ctor;+ return ord=== 'EQ' ? 0 : ord === 'LT' ? -1 : 1;+ }+ return fromArray(toArray(xs).sort(cmp));+ }++ function nth(xs, n) {+ return toArray(xs)[n];+ }++ function take(n, xs) {+ var arr = [];+ while (xs.ctor !== '[]' && n > 0) {+ arr.push(xs._0);+ xs = xs._1;+ --n;+ }+ return fromArray(arr);+ }++ function drop(n, xs) {+ while (xs.ctor !== '[]' && n > 0) {+ xs = xs._1;+ --n;+ }+ return xs;+ }++ function repeat(n, x) {+ var arr = [];+ var pattern = [x];+ while (n > 0) {+ if (n & 1) arr = arr.concat(pattern);+ n >>= 1, pattern = pattern.concat(pattern);+ }+ return fromArray(arr);+ }++ function join(sep, xss) {+ if (sep.isText) return Utils.txt(toArray(xss).join(sep));+ if (typeof sep === 'string') return toArray(xss).join(sep);+ if (xss.ctor === '[]') return Nil;+ var s = toArray(sep);+ var out = toArray(xss._0);+ xss = xss._1;+ while (xss.ctor !== '[]') {+ out = out.concat(s, toArray(xss._0));+ xss = xss._1;+ }+ return fromArray(out);+ }++ Elm.Native.List.values = {+ Nil:Nil,+ Cons:Cons,+ cons:F2(Cons),+ toArray:toArray,+ fromArray:fromArray,+ range:range,+ append:append,++ head:head,+ tail:tail,+ last:last,++ map:F2(map),+ foldl:F3(foldl),+ foldr:F3(foldr),++ foldl1:F2(foldl1),+ foldr1:F2(foldr1),+ scanl:F3(scanl),+ scanl1:F2(scanl1),+ filter:F2(filter),+ length:length,+ member:F2(member),+ reverse:reverse,+ concat:concat,++ all:F2(all),+ any:F2(any),+ zipWith:F3(zipWith),+ zip:F2(zip),+ sort:sort,+ nth:F2(nth),+ take:F2(take),+ drop:F2(drop),+ repeat:F2(repeat),++ join:F2(join)+ };+ return elm.Native.List.values = Elm.Native.List.values;++};+Elm.Native.Prelude = {};+Elm.Native.Prelude.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Prelude = elm.Native.Prelude || {};+ if (elm.Native.Prelude.values) return elm.Native.Prelude.values;++ var JS = Elm.Native.JavaScript.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var Char = Elm.Char.make(elm);++ function readInt(str) {+ var s = JS.fromString(str);+ var len = s.length;+ if (len === 0) { return Maybe.Nothing; }+ var start = 0;+ if (s[0] == '-') {+ if (len === 1) { return Maybe.Nothing; }+ start = 1;+ }+ for (var i = start; i < len; ++i) {+ if (!Char.isDigit(s[i])) { return Maybe.Nothing; }+ }+ return Maybe.Just(parseInt(s, 10));+ }++ function readFloat(str) {+ var s = JS.fromString(str);+ var len = s.length;+ if (len === 0) { return Maybe.Nothing; }+ var start = 0;+ if (s[0] == '-') {+ if (len === 1) { return Maybe.Nothing; }+ start = 1;+ }+ var dotCount = 0;+ for (var i = start; i < len; ++i) {+ if (Char.isDigit(s[i])) { continue; }+ if (s[i] === '.') {+ dotCount += 1;+ if (dotCount <= 1) { continue; }+ }+ return Maybe.Nothing;+ }+ return Maybe.Just(parseFloat(s));+ }++ return elm.Native.Prelude.values = {+ readInt:readInt,+ readFloat:readFloat+ };++};+Elm.Native.Show = {};+Elm.Native.Show.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Show = elm.Native.Show || {};+ if (elm.Native.Show.values) return elm.Native.Show.values;++ var NList = Elm.Native.List.make(elm);+ var List = Elm.List.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JS = Elm.JavaScript.make(elm);+ var Dict = Elm.Dict.make(elm);+ var Json = Elm.Json.make(elm);+ var Tuple2 = Elm.Native.Utils.make(elm).Tuple2;++ var toString = function(v) {+ var type = typeof v;+ if (type === "function") {+ var name = v.func ? v.func.name : v.name;+ return '<function' + (name === '' ? '' : ': ') + name + '>';+ } else if (type === "boolean") {+ return v ? "True" : "False";+ } else if (type === "number") {+ return v+"";+ } else if (v.isChar && v instanceof String) {+ return "'" + addSlashes(v) + "'";+ } else if (type === "string") {+ return '"' + addSlashes(v) + '"';+ } else if (type === "object" && '_' in v) {+ var output = [];+ for (var k in v._) {+ for (var i = v._[k].length; i--; ) {+ output.push(k + " = " + toString(v._[k][i]));+ }+ }+ for (var k in v) {+ if (k === '_') continue;+ output.push(k + " = " + toString(v[k]));+ }+ if (output.length === 0) return "{}";+ return "{ " + output.join(", ") + " }";+ } else if (type === "object" && 'ctor' in v) {+ if (v.ctor.substring(0,6) === "_Tuple") {+ var output = [];+ for (var k in v) {+ if (k === 'ctor') continue;+ output.push(toString(v[k]));+ }+ return "(" + output.join(",") + ")";+ } else if (v.ctor === "::") {+ var output = '[' + toString(v._0);+ v = v._1;+ while (v.ctor === "::") {+ output += "," + toString(v._0);+ v = v._1;+ }+ return output + ']';+ } else if (v.ctor === "[]") {+ return "[]";+ } else if (v.ctor === "RBNode" || v.ctor === "RBEmpty") {+ var cons = F3(function(k,v,acc){return NList.Cons(Tuple2(k,v),acc)});+ var list = A3(Dict.foldr, cons, NList.Nil, v);+ var name = "Dict";+ if (list.ctor === "::" && list._0._1.ctor === "_Tuple0") {+ name = "Set";+ list = A2(List.map, function(x){return x._0}, list);+ }+ return name + ".fromList " + toString(list);+ } else {+ var output = "";+ for (var i in v) {+ if (i === 'ctor') continue;+ var str = toString(v[i]);+ var parenless = str[0] === '{' || str[0] === '<' || str.indexOf(' ') < 0;+ output += ' ' + (parenless ? str : '(' + str + ')');+ }+ return v.ctor + output;+ }+ }+ if (type === 'object' && 'recv' in v) return '<signal>';+ return "<internal structure>";+ };++ function addSlashes(str) {+ return str.replace(/\\/g, '\\\\')+ .replace(/\n/g, '\\n')+ .replace(/\t/g, '\\t')+ .replace(/\r/g, '\\r')+ .replace(/\v/g, '\\v')+ .replace(/\0/g, '\\0')+ .replace(/\'/g, "\\'")+ .replace(/\"/g, '\\"');+ }++ return elm.Native.Show.values = { show:toString };+};+Elm.Native.String = {};+Elm.Native.String.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.String = elm.Native.String || {};+ if (elm.Native.String.values) return elm.Native.String.values;+ if ('values' in Elm.Native.String)+ return elm.Native.String.values = Elm.Native.String.values;++ var Char = Elm.Char.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JS = Elm.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ function isEmpty(str) {+ return str.length === 0;+ }+ function cons(chr,str) {+ return chr + str;+ }+ function uncons(str) {+ var hd;+ return (hd = str[0]) ? Maybe.Just(Utils.Tuple2(Utils.chr(hd), str.slice(1)))+ : Maybe.Nothing;+ }+ function append(a,b) {+ return a + b;+ }+ function concat(strs) {+ return JS.fromList(strs).join('');+ }+ function length(str) {+ return str.length;+ }+ function map(f,str) {+ var out = str.split('');+ for (var i = out.length; i--; ) {+ out[i] = f(Utils.chr(out[i]));+ }+ return out.join('');+ }+ function filter(pred,str) {+ return str.split('').map(Utils.chr).filter(pred).join('');+ }+ function reverse(str) {+ return str.split('').reverse().join('');+ }+ function foldl(f,b,str) {+ var len = str.length;+ for (var i = 0; i < len; ++i) {+ b = A2(f, Utils.chr(str[i]), b);+ }+ return b;+ }+ function foldr(f,b,str) {+ for (var i = str.length; i--; ) {+ b = A2(f, Utils.chr(str[i]), b);+ }+ return b;+ }++ function split(sep, str) {+ return JS.toList(str.split(sep));+ }+ function join(sep, strs) {+ return JS.fromList(strs).join(sep);+ }+ function repeat(n, str) {+ var result = '';+ while (n > 0) {+ if (n & 1) result += str;+ n >>= 1, str += str;+ }+ return result;+ }++ function sub(start, end, str) {+ return str.slice(start,end);+ }+ function left(n, str) {+ return n < 1 ? "" : str.slice(0,n);+ }+ function right(n, str) {+ return n < 1 ? "" : str.slice(-n);+ }+ function dropLeft(n, str) {+ return n < 1 ? str : str.slice(n);+ }+ function dropRight(n, str) {+ return n < 1 ? str : str.slice(0,-n);+ }++ function pad(n,chr,str) {+ var half = (n - str.length) / 2;+ return repeat(Math.ceil(half),chr) + str + repeat(half|0,chr);+ }+ function padRight(n,chr,str) {+ return str + repeat(n - str.length, chr);+ }+ function padLeft(n,chr,str) {+ return repeat(n - str.length, chr) + str;+ }++ function trim(str) {+ return str.trim();+ }+ function trimLeft(str) {+ return str.trimLeft();+ }+ function trimRight(str) {+ return str.trimRight();+ }++ function words(str) {+ return JS.toList(str.split(/\s+/g));+ }+ function lines(str) {+ return JS.toList(str.split(/\r\n|\r|\n/g));+ }++ function toUpper(str) {+ return str.toUpperCase();+ }+ function toLower(str) {+ return str.toLowerCase();+ }++ function any(pred, str) {+ for (var i = str.length; i--; ) {+ if (pred(Utils.chr(str[i]))) return true;+ }+ return false;+ }+ function all(pred, str) {+ for (var i = str.length; i--; ) {+ if (!pred(Utils.chr(str[i]))) return false;+ }+ return true;+ }++ function contains(sub, str) {+ return str.indexOf(sub) > -1;+ }+ function startsWith(sub, str) {+ return str.indexOf(sub) === 0;+ }+ function endsWith(sub, str) {+ return str.lastIndexOf(sub) === str.length - sub.length;+ }+ function indexes(sub, str) {+ var subLen = sub.length;+ var i = 0;+ var is = [];+ while ((i = str.indexOf(sub, i)) > -1) {+ is.push(i);+ i = i + subLen;+ }+ return JS.toList(is);+ }++ function toInt(s) {+ var len = s.length;+ if (len === 0) { return Maybe.Nothing; }+ var start = 0;+ if (s[0] == '-') {+ if (len === 1) { return Maybe.Nothing; }+ start = 1;+ }+ for (var i = start; i < len; ++i) {+ if (!Char.isDigit(s[i])) { return Maybe.Nothing; }+ }+ return Maybe.Just(parseInt(s, 10));+ }++ function toFloat(s) {+ var len = s.length;+ if (len === 0) { return Maybe.Nothing; }+ var start = 0;+ if (s[0] == '-') {+ if (len === 1) { return Maybe.Nothing; }+ start = 1;+ }+ var dotCount = 0;+ for (var i = start; i < len; ++i) {+ if (Char.isDigit(s[i])) { continue; }+ if (s[i] === '.') {+ dotCount += 1;+ if (dotCount <= 1) { continue; }+ }+ return Maybe.Nothing;+ }+ return Maybe.Just(parseFloat(s));+ }++ function toList(str) {+ return JS.toList(str.split('').map(Utils.chr));+ }+ function fromList(chars) {+ return JS.fromList(chars).join('');+ }++ return Elm.Native.String.values = {+ isEmpty: isEmpty,+ cons: F2(cons),+ uncons: uncons,+ append: F2(append),+ concat: concat,+ length: length,+ map: F2(map),+ filter: F2(filter),+ reverse: reverse,+ foldl: F3(foldl),+ foldr: F3(foldr),++ split: F2(split),+ join: F2(join),+ repeat: F2(repeat),++ sub: F3(sub),+ left: F2(left),+ right: F2(right),+ dropLeft: F2(dropLeft),+ dropRight: F2(dropRight),++ pad: F3(pad),+ padLeft: F3(padLeft),+ padRight: F3(padRight),++ trim: trim,+ trimLeft: trimLeft,+ trimRight: trimRight,++ words: words,+ lines: lines,++ toUpper: toUpper,+ toLower: toLower,++ any: F2(any),+ all: F2(all),++ contains: F2(contains),+ startsWith: F2(startsWith),+ endsWith: F2(endsWith),+ indexes: F2(indexes),++ toInt: toInt,+ toFloat: toFloat,+ toList: toList,+ fromList: fromList,+ };+};Elm.Native.Text = {};+Elm.Native.Text.make = function(elm) {+ elm.Native = elm.Native || {};+ elm.Native.Text = elm.Native.Text || {};+ if (elm.Native.Text.values) return elm.Native.Text.values;++ var JS = Elm.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);+ var Color = Elm.Native.Color.make(elm);+ var Element = Elm.Graphics.Element.make(elm);+ var show = Elm.Native.Show.make(elm).show;++ function makeSpaces(s) {+ if (s.length == 0) { return s; }+ var arr = s.split('');+ if (arr[0] == ' ') { arr[0] = " " } + for (var i = arr.length; --i; ) {+ if (arr[i][0] == ' ' && arr[i-1] == ' ') {+ arr[i-1] = arr[i-1] + arr[i];+ arr[i] = '';+ }+ }+ for (var i = arr.length; i--; ) {+ if (arr[i].length > 1 && arr[i][0] == ' ') {+ var spaces = arr[i].split('');+ for (var j = spaces.length - 2; j >= 0; j -= 2) {+ spaces[j] = ' ';+ }+ arr[i] = spaces.join('');+ }+ }+ arr = arr.join('');+ if (arr[arr.length-1] === " ") {+ return arr.slice(0,-1) + ' ';+ }+ return arr;+ }++ function properEscape(str) {+ if (str.length == 0) return str;+ str = str //.replace(/&/g, "&")+ .replace(/"/g, '"')+ .replace(/'/g, "'")+ .replace(/</g, "<")+ .replace(/>/g, ">")+ .replace(/\n/g, "<br/>");+ var arr = str.split('<br/>');+ for (var i = arr.length; i--; ) {+ arr[i] = makeSpaces(arr[i]);+ }+ return arr.join('<br/>');+ }++ function toText(str) { return Utils.txt(properEscape(JS.fromString(str))); }++ function addTag(tag) {+ return function(text) {+ return Utils.txt('<' + tag + '>' + text + '</' + tag + '>');+ }+ }+ + function addStyle(style, value, text) {+ return Utils.txt("<span style='" + style + ":" + value + "'>" + text + "</span>");+ }++ function typeface(name, text) {+ return addStyle('font-family', JS.fromString(name), text);+ }+ function monospace(text) {+ return addStyle('font-family', 'monospace', text);+ }+ function size(px, text) { return addStyle('font-size', px + 'px', text) }+ var header = addTag('h1');+ function height(h, text) { return addStyle('font-size', h+'px', text) }+ function italic(text) { return addStyle('font-style', 'italic', text) }+ var bold = addTag('b');++ function extract(c) {+ if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }+ return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';+ }+ function color(c, text) {+ return addStyle('color', extract(c), text);+ }+ function underline(text) { return addStyle('text-decoration', 'underline', text) }+ function overline(text) { return addStyle('text-decoration', 'overline', text) }+ function strikeThrough(text) {+ return addStyle('text-decoration', 'line-through', text);+ }+ function link(href, text) {+ return Utils.txt("<a href='" + toText(href) + "'>" + text + "</a>");+ }++ function position(pos) {+ return function(text) {+ var e = {ctor:'RawHtml',+ _0: '<div style="padding:0;margin:0;text-align:' ++ pos + '">' + text + '</div>'+ };+ var p = A2(Utils.htmlHeight, 0, text);+ return A3(Element.newElement, p._0, p._1, e);+ }+ }++ function asText(v) {+ return position('left')(monospace(toText(show(v))));+ }++ function plainText(v) {+ return position('left')(toText(v));+ }++ return elm.Native.Text.values = {+ toText: toText,++ header : header,+ height : F2(height),+ italic : italic,+ bold : bold,+ underline : underline,+ overline : overline,+ strikeThrough : strikeThrough,+ monospace : monospace,+ typeface : F2(typeface),+ color : F2(color),+ link : F2(link),++ justified : position('justify'),+ centered : position('center'),+ righted : position('right'),+ text : position('left'),+ plainText : plainText,++ asText : asText+ };+};Elm.Native.Transform2D = {};+Elm.Native.Transform2D.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Transform2D = elm.Native.Transform2D || {};+ if (elm.Native.Transform2D.values) return elm.Native.Transform2D.values;++ var A;+ if (typeof Float32Array === 'undefined') {+ A = function(arr) {+ this.length = arr.length;+ this[0] = arr[0];+ this[1] = arr[1];+ this[2] = arr[2];+ this[3] = arr[3];+ this[4] = arr[4];+ this[5] = arr[5];+ };+ } else {+ A = Float32Array;+ }++ // layout of matrix in an array is+ //+ // | m11 m12 dx |+ // | m21 m22 dy |+ // | 0 0 1 |+ //+ // new A([ m11, m12, dx, m21, m22, dy ])++ var identity = new A([1,0,0,0,1,0]);+ function matrix(m11, m12, m21, m22, dx, dy) {+ return new A([m11, m12, dx, m21, m22, dy]);+ }+ function rotation(t) {+ var c = Math.cos(t);+ var s = Math.sin(t);+ return new A([c, -s, 0, s, c, 0]);+ }++ function rotate(t,m) {+ var c = Math.cos(t);+ var s = Math.sin(t);+ var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4];+ return new A([m11*c + m12*s, -m11*s + m12*c, m[2],+ m21*c + m22*s, -m21*s + m22*c, m[5]]);+ }+ /*+ function move(xy,m) {+ var x = xy._0;+ var y = xy._1;+ var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4];+ return new A([m11, m12, m11*x + m12*y + m[2],+ m21, m22, m21*x + m22*y + m[5]]);+ }+ function scale(s,m) { return new A([m[0]*s, m[1]*s, m[2], m[3]*s, m[4]*s, m[5]]); }+ function scaleX(x,m) { return new A([m[0]*x, m[1], m[2], m[3]*x, m[4], m[5]]); }+ function scaleY(y,m) { return new A([m[0], m[1]*y, m[2], m[3], m[4]*y, m[5]]); }+ function reflectX(m) { return new A([-m[0], m[1], m[2], -m[3], m[4], m[5]]); }+ function reflectY(m) { return new A([m[0], -m[1], m[2], m[3], -m[4], m[5]]); }++ function transform(m11, m21, m12, m22, mdx, mdy, n) {+ var n11 = n[0], n12 = n[1], n21 = n[3], n22 = n[4], ndx = n[2], ndy = n[5];+ return new A([m11*n11 + m12*n21,+ m11*n12 + m12*n22,+ m11*ndx + m12*ndy + mdx,+ m21*n11 + m22*n21,+ m21*n12 + m22*n22,+ m21*ndx + m22*ndy + mdy]);+ }+ */+ function multiply(m, n) {+ var m11 = m[0], m12 = m[1], m21 = m[3], m22 = m[4], mdx = m[2], mdy = m[5];+ var n11 = n[0], n12 = n[1], n21 = n[3], n22 = n[4], ndx = n[2], ndy = n[5];+ return new A([m11*n11 + m12*n21,+ m11*n12 + m12*n22,+ m11*ndx + m12*ndy + mdx,+ m21*n11 + m22*n21,+ m21*n12 + m22*n22,+ m21*ndx + m22*ndy + mdy]);+ }++ return elm.Native.Transform2D.values = {+ identity:identity,+ matrix:F6(matrix),+ rotation:rotation,+ multiply:F2(multiply)+ /*+ transform:F7(transform),+ rotate:F2(rotate),+ move:F2(move),+ scale:F2(scale),+ scaleX:F2(scaleX),+ scaleY:F2(scaleY),+ reflectX:reflectX,+ reflectY:reflectY+ */+ };++};+Elm.Native.Utils = {};+Elm.Native.Utils.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Utils = elm.Native.Utils || {};+ if (elm.Native.Utils.values) return elm.Native.Utils.values;++ function eq(x,y) {+ if (x === y) return true;+ if (typeof x === "object") {+ var c = 0;+ for (var i in x) { ++c; if (!eq(x[i],y[i])) return false; }+ return c === Object.keys(y).length;+ }+ if (typeof x === 'function') {+ throw new Error('Equality error: general function equality is ' ++ 'undecidable, and therefore, unsupported');+ }+ return x === y;+ }++ // code in Generate/JavaScript.hs depends on the particular+ // integer values assigned to LT, EQ, and GT+ var LT = -1, EQ = 0, GT = 1, ord = ['LT','EQ','GT'];+ function compare(x,y) { return { ctor: ord[cmp(x,y)+1] } }+ function cmp(x,y) {+ var ord;+ if (typeof x !== 'object') return x === y ? EQ : x < y ? LT : GT;++ if (x.ctor === "::" || x.ctor === "[]") {+ while (true) {+ if (x.ctor === "[]" && y.ctor === "[]") return EQ;+ if (x.ctor !== y.ctor) return x.ctor === '[]' ? LT : GT;+ ord = cmp(x._0, y._0);+ if (ord !== EQ) return ord;+ x = x._1;+ y = y._1;+ }+ }++ if (x.ctor.slice(0,6) === '_Tuple') {+ var n = x.ctor.slice(6) - 0;+ var err = 'cannot compare tuples with more than 6 elements.';+ if (n === 0) return EQ;+ if (n >= 1) { ord = cmp(x._0, y._0); if (ord !== EQ) return ord;+ if (n >= 2) { ord = cmp(x._1, y._1); if (ord !== EQ) return ord;+ if (n >= 3) { ord = cmp(x._2, y._2); if (ord !== EQ) return ord;+ if (n >= 4) { ord = cmp(x._3, y._3); if (ord !== EQ) return ord;+ if (n >= 5) { ord = cmp(x._4, y._4); if (ord !== EQ) return ord;+ if (n >= 6) { ord = cmp(x._5, y._5); if (ord !== EQ) return ord;+ if (n >= 7) throw new Error('Comparison error: ' + err); } } } } } }+ return EQ;+ }+ throw new Error('Comparison error: comparison is only defined on ints, ' ++ 'floats, times, chars, strings, lists of comparable values, ' ++ 'and tuples of comparable values.')+ }+++ var Tuple0 = { ctor: "_Tuple0" };+ function Tuple2(x,y) { return { ctor:"_Tuple2", _0:x, _1:y } }++ function chr(c) {+ var x = new String(c);+ x.isChar = true;+ return x;+ }++ function txt(str) {+ var t = new String(str);+ t.isText = true;+ return t;+ }++ var count = 0;+ function guid(_) { return count++ }++ function copy(r) {+ var o = {};+ for (var i in r) { o[i] = r[i]; }+ return o;+ }++ function remove(x,r) {+ var o = copy(r);+ if (x in o._) {+ o[x] = o._[x][0];+ o._[x] = o._[x].slice(1);+ if (o._[x].length === 0) { delete o._[x]; }+ } else {+ delete o[x];+ }+ return o;+ }++ function replace(kvs,r) {+ var o = copy(r);+ for (var i = kvs.length; i--; ) {+ var kvsi = kvs[i];+ o[kvsi[0]] = kvsi[1];+ }+ return o;+ }++ function insert(x,v,r) {+ var o = copy(r);+ if (x in o) o._[x] = [o[x]].concat(x in o._ ? o._[x].slice(0) : []);+ o[x] = v;+ return o;+ }++ function max(a,b) { return a > b ? a : b }+ function min(a,b) { return a < b ? a : b }++ function mod(a,b) {+ if (b === 0) {+ throw new Error("Cannot perform mod 0. Division by zero error.");+ }+ var r = a % b;+ var m = a === 0 ? 0 : (b > 0 ? (a >= 0 ? r : r+b) : -mod(-a,-b));++ return m === b ? 0 : m;+ }++ function htmlHeight(width, html) {+ var t = document.createElement('div');+ t.innerHTML = html;+ if (width > 0) { t.style.width = width + "px"; }+ t.style.visibility = "hidden";+ t.style.styleFloat = "left";+ t.style.cssFloat = "left";++ document.body.appendChild(t);+ var style = window.getComputedStyle(t, null);+ var w = Math.ceil(style.getPropertyValue("width").slice(0,-2) - 0);+ var h = Math.ceil(style.getPropertyValue("height").slice(0,-2) - 0);+ document.body.removeChild(t);+ return Tuple2(w,h);+ }++ function getXY(e) {+ var posx = 0;+ var posy = 0;+ if (e.pageX || e.pageY) {+ posx = e.pageX;+ posy = e.pageY;+ } else if (e.clientX || e.clientY) {+ posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;+ posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;+ }++ if (elm.display === ElmRuntime.Display.COMPONENT) {+ var rect = elm.node.getBoundingClientRect();+ var relx = rect.left + document.body.scrollLeft + document.documentElement.scrollLeft;+ var rely = rect.top + document.body.scrollTop + document.documentElement.scrollTop;+ // TODO: figure out if there is a way to avoid rounding here+ posx = posx - Math.round(relx) - elm.node.clientLeft;+ posy = posy - Math.round(rely) - elm.node.clientTop;+ }+ return Tuple2(posx, posy);+ }++ return elm.Native.Utils.values = {+ eq:eq,+ cmp:cmp,+ compare:F2(compare),+ Tuple0:Tuple0,+ Tuple2:Tuple2,+ chr:chr,+ txt:txt,+ copy: copy,+ remove: remove,+ replace: replace,+ insert: insert,+ guid: guid,+ max : F2(max),+ min : F2(min),+ mod : F2(mod),+ htmlHeight: F2(htmlHeight),+ getXY: getXY,+ toFloat: function(x) { return +x; }+ };+};+Elm.Native.Graphics.Collage = {};+Elm.Native.Graphics.Collage.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Graphics = elm.Native.Graphics || {};+ elm.Native.Graphics.Collage = elm.Native.Graphics.Collage || {};+ if (elm.Native.Graphics.Collage.values) return elm.Native.Graphics.Collage.values;++ var newElement = Elm.Graphics.Element.make(elm).newElement;+ var C = ElmRuntime.use(ElmRuntime.Render.Collage);++ function collage(w,h,forms) {+ return A3(newElement, w, h, {+ ctor: 'Custom',+ type: 'Collage',+ render: C.render,+ update: C.update,+ model: {w:w, h:h, forms:forms}+ });+ }+ return elm.Native.Graphics.Collage.values = { collage:F3(collage) };++};Elm.Native.Graphics.Input = {};+Elm.Native.Graphics.Input.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Graphics = elm.Native.Graphics || {};+ elm.Native.Graphics.Input = elm.Native.Graphics.Input || {};+ if (elm.Native.Graphics.Input.values) return elm.Native.Graphics.Input.values;++ var Render = ElmRuntime.use(ElmRuntime.Render.Element);+ var newNode = ElmRuntime.use(ElmRuntime.Render.Utils).newElement;++ var Signal = Elm.Signal.make(elm);+ var newElement = Elm.Graphics.Element.make(elm).newElement;+ var JS = Elm.Native.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);+ var Tuple2 = Utils.Tuple2;++ function dropDown(values) {+ var entries = JS.fromList(values);+ var events = Signal.constant(entries[0]._1);++ var drop = newNode('select');+ drop.style.border = '0 solid';+ for (var i = 0; i < entries.length; ++i) {+ var option = newNode('option');+ var name = JS.fromString(entries[i]._0);+ option.value = name;+ option.innerHTML = name;+ drop.appendChild(option);+ }+ drop.addEventListener('change', function() {+ elm.notify(events.id, entries[drop.selectedIndex]._1);+ });++ var t = drop.cloneNode(true);+ t.style.visibility = "hidden";++ elm.node.appendChild(t);+ var style = window.getComputedStyle(t, null);+ var w = Math.ceil(style.getPropertyValue("width").slice(0,-2) - 0);+ var h = Math.ceil(style.getPropertyValue("height").slice(0,-2) - 0);+ elm.node.removeChild(t);+ + console.log(w,h);+ var element = A3(newElement, w, h, {+ ctor: 'Custom',+ type: 'DropDown',+ render: function render(model) { return drop; },+ update: function update(node, oldModel, newModel) {},+ model: {}+ });++ return Tuple2(Signal.constant(element), events);+ }++ function buttons(defaultValue) {+ var events = Signal.constant(defaultValue);++ function render(model) {+ var b = newNode('button');+ b.style.display = 'block';+ b.elmEvent = model.event;+ function click() { elm.notify(events.id, b.elmEvent); }+ b.addEventListener('click', click);+ b.innerHTML = model.text;+ return b;+ }++ function update(node, oldModel, newModel) {+ node.elmEvent = newModel.event;+ var txt = newModel.text;+ if (oldModel.text !== txt) node.innerHTML = txt;+ }++ function button(evnt, txt) {+ return A3(newElement, 100, 40, {+ ctor: 'Custom',+ type: 'Button',+ render: render,+ update: update,+ model: { event:evnt, text:JS.fromString(txt) }+ });+ }++ return { _:{}, button:F2(button), events:events };+ }++ function customButtons(defaultValue) {+ var events = Signal.constant(defaultValue);++ function render(model) {+ var btn = newNode('div');+ btn.elmEvent = model.event;++ btn.elmUp = Render.render(model.up);+ btn.elmHover = Render.render(model.hover);+ btn.elmDown = Render.render(model.down);++ function replace(node) {+ if (node !== btn.firstChild) btn.replaceChild(node, btn.firstChild);+ }+ var overCount = 0;+ function over(e) {+ if (overCount++ > 0) return;+ replace(btn.elmHover);+ }+ function out(e) {+ if (btn.contains(e.toElement || e.relatedTarget)) return;+ overCount = 0;+ replace(btn.elmUp);+ }+ function up() {+ replace(btn.elmHover);+ elm.notify(events.id, btn.elmEvent);+ }+ function down() { replace(btn.elmDown); }+ btn.addEventListener('mouseover', over);+ btn.addEventListener('mouseout' , out);+ btn.addEventListener('mousedown', down);+ btn.addEventListener('mouseup' , up);++ btn.appendChild(btn.elmUp);++ var clicker = newNode('div');+ clicker.style.width = btn.elmUp.style.width;+ clicker.style.height = btn.elmUp.style.height;+ clicker.style.position = 'absolute';+ clicker.style.top = 0;+ btn.appendChild(clicker);++ return btn;+ }++ function update(node, oldModel, newModel) {+ node.elmEvent = newModel.event;+ Render.update(node.elmUp, oldModel.up, newModel.up)+ Render.update(node.elmHover, oldModel.hover, newModel.hover)+ Render.update(node.elmDown, oldModel.down, newModel.down)+ }++ function button(evnt, up, hover, down) {+ return A3(newElement,+ Math.max(up.props.width, hover.props.width, down.props.width),+ Math.max(up.props.height, hover.props.height, down.props.height),+ { ctor: 'Custom',+ type: 'CustomButton',+ render: render,+ update: update,+ model: { event:evnt, up:up, hover:hover, down:down }+ });+ }++ return { _:{}, customButton:F4(button), events:events };+ }+++ function hoverables(defaultValue) {+ var events = Signal.constant(defaultValue);+ function hoverable(handler, elem) {+ function onHover(bool) {+ elm.notify(events.id, handler(bool));+ }+ var props = Utils.replace([['hover',onHover]], elem.props);+ return { props:props, element:elem.element };+ }+ return { _:{}, hoverable:F2(hoverable), events:events };+ }+++ function checkboxes(defaultValue) {+ var events = Signal.constant(defaultValue);++ function render(model) {+ var b = newNode('input');+ b.type = 'checkbox';+ b.checked = model.checked;+ b.style.display = 'block';+ b.elmHandler = model.handler;+ function change() { elm.notify(events.id, b.elmHandler(b.checked)); }+ b.addEventListener('change', change);+ return b;+ }++ function update(node, oldModel, newModel) {+ node.elmHandler = newModel.handler;+ node.checked = newModel.checked;+ return true;+ }++ function box(handler, checked) {+ return A3(newElement, 13, 13, {+ ctor: 'Custom',+ type: 'CheckBox',+ render: render,+ update: update,+ model: { checked:checked, handler:handler }+ });+ }++ return { _:{}, checkbox:F2(box), events:events };+ }++ function setRange(node, start, end, dir) {+ if (node.parentNode) {+ node.setSelectionRange(start, end, dir);+ } else {+ setTimeout(function(){node.setSelectionRange(start, end, dir);}, 0);+ }+ }++ function mkTextPool(type) { return function fields(defaultValue) {+ var events = Signal.constant(defaultValue);++ var state = null;++ function render(model) {+ var field = newNode('input');+ field.elmHandler = model.handler;++ field.id = 'test';+ field.type = type;+ field.placeholder = JS.fromString(model.placeHolder);+ field.value = JS.fromString(model.state.string);+ setRange(field, model.state.selectionStart, model.state.selectionEnd, 'forward');+ field.style.border = 'none';+ state = model.state;++ function update() {+ var start = field.selectionStart,+ end = field.selectionEnd;+ if (field.selectionDirection === 'backward') {+ start = end;+ end = field.selectionStart;+ }+ state = { _:{},+ string:JS.toString(field.value),+ selectionStart:start,+ selectionEnd:end };+ elm.notify(events.id, field.elmHandler(state));+ }+ function mousedown() {+ update();+ elm.node.addEventListener('mouseup', mouseup);+ }+ function mouseup() {+ update();+ elm.node.removeEventListener('mouseup', mouseup)+ }+ field.addEventListener('keyup', update);+ field.addEventListener('mousedown', mousedown);++ return field;+ }++ function update(node, oldModel, newModel) {+ node.elmHandler = newModel.handler;+ if (state === newModel.state) return;+ var newStr = JS.fromString(newModel.state.string);+ if (node.value !== newStr) node.value = newStr;++ var start = newModel.state.selectionStart;+ var end = newModel.state.selectionEnd;+ var direction = 'forward';+ if (end < start) {+ start = end;+ end = newModel.state.selectionStart;+ direction = 'backward';+ }+ + if (node.selectionStart !== start+ || node.selectionEnd !== end+ || node.selectionDirection !== direction) {+ setRange(node, start, end, direction);+ }+ }++ function field(handler, placeHolder, state) {+ return A3(newElement, 200, 30,+ { ctor: 'Custom',+ type: type + 'Input',+ render: render,+ update: update,+ model: { handler:handler,+ placeHolder:placeHolder,+ state:state }+ });+ }++ return { _:{}, field:F3(field), events:events };+ }+ }++ return elm.Native.Graphics.Input.values = {+ buttons:buttons,+ customButtons:customButtons,+ hoverables:hoverables,+ checkboxes:checkboxes,+ fields:mkTextPool('text'),+ emails:mkTextPool('email'),+ passwords:mkTextPool('password'),+ dropDown:dropDown+ };++};+Elm.Native.Http = {};+Elm.Native.Http.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Http = elm.Native.Http || {};+ if (elm.Native.Http.values) return elm.Native.Http.values;+++ var JS = Elm.JavaScript.make(elm);+ var List = Elm.List.make(elm);+ var Signal = Elm.Signal.make(elm);+++ function registerReq(queue,responses) { return function(req) {+ if (req.url.ctor !== '[]') { sendReq(queue,responses,req); }+ };+ }++ function updateQueue(queue,responses) {+ if (queue.length > 0) {+ elm.notify(responses.id, queue[0].value);+ if (queue[0].value.ctor !== 'Waiting') {+ queue.shift();+ setTimeout(function() { updateQueue(queue,responses); }, 0);+ }+ }+ }++ function setHeader(pair) {+ request.setRequestHeader( JS.fromString(pair._0), JS.fromString(pair._1) );+ }++ function sendReq(queue,responses,req) {+ var response = { value: { ctor:'Waiting' } };+ queue.push(response);++ var request = null;+ if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); }+ if (window.XMLHttpRequest) { request = new XMLHttpRequest(); }+ request.onreadystatechange = function(e) {+ if (request.readyState === 4) {+ response.value = (request.status >= 200 && request.status < 300 ?+ { ctor:'Success', _0:JS.toString(request.responseText) } :+ { ctor:'Failure', _0:request.status, _1:JS.toString(request.statusText) });+ setTimeout(function() { updateQueue(queue,responses); }, 0);+ }+ };+ request.open(JS.fromString(req.verb), JS.fromString(req.url), true);+ List.map(setHeader)(req.headers);+ request.send(JS.fromString(req.body));+ }++ function send(requests) {+ var responses = Signal.constant(elm.Http.values.Waiting);+ var sender = A2( Signal.lift, registerReq([],responses), requests );+ function f(x) { return function(y) { return x; } }+ return A3( Signal.lift2, f, responses, sender );+ }++ return elm.Native.Http.values = {send:send};++};+Elm.Native.Keyboard = {};+Elm.Native.Keyboard.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Keyboard = elm.Native.Keyboard || {};+ if (elm.Native.Keyboard.values) return elm.Native.Keyboard.values;++ // Duplicated from Native.Signal+ function send(node, timestep, changed) {+ var kids = node.kids;+ for (var i = kids.length; i--; ) {+ kids[i].recv(timestep, changed, node.id);+ }+ }++ var Signal = Elm.Signal.make(elm);+ var NList = Elm.Native.List.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ var downEvents = Signal.constant(0);+ var upEvents = Signal.constant(0);+ var blurEvents = Signal.constant(0);++ elm.addListener([downEvents.id], document, 'keydown', function down(e) {+ elm.notify(downEvents.id, e.keyCode);+ });++ elm.addListener([upEvents.id], document, 'keyup', function up(e) {+ elm.notify(upEvents.id, e.keyCode);+ });++ elm.addListener([blurEvents.id], document, 'blur', function blur(e) {+ elm.notify(blurEvents.id, NList.Nil);+ });++ function KeyMerge(down, up, blur) {+ var args = [down,up,blur];+ this.id = Utils.guid();+ // Ignore starting values here+ this.value = NList.Nil+ this.kids = [];+ + var n = args.length;+ var count = 0;+ var isChanged = false;++ this.recv = function(timestep, changed, parentID) {+ ++count;+ if (changed) { + // We know this a change must only be one of the following cases+ if (parentID === down.id && !(NList.member(down.value)(this.value))) {+ isChanged = true;+ this.value = NList.Cons(down.value, this.value); + } + if (parentID === up.id) {+ isChanged = true;+ var notEq = function(kc) { return kc !== up.value };+ this.value = NList.filter(notEq)(this.value);+ } + if (parentID === blur.id) {+ isChanged = true;+ this.value = NList.Nil;+ }+ }+ if (count == n) {+ send(this, timestep, isChanged);+ isChanged = false;+ count = 0;+ }+ };++ for (var i = n; i--; ) { args[i].kids.push(this); }++ }++ var keysDown = Signal.dropRepeats(new KeyMerge(downEvents,upEvents,blurEvents));++ function keySignal(f) {+ var signal = A2(Signal.lift, f, keysDown);+ // must set the default number of kids to make it possible to filter+ // these signals if they are not actually used.+ keysDown.defaultNumberOfKids += 1;+ signal.defaultNumberOfKids = 1;+ var filtered = Signal.dropRepeats(signal)+ filtered.defaultNumberOfKids = 0;+ return filtered;+ }++ function dir(up, down, left, right) {+ function f(ks) {+ var x = 0, y = 0;+ while (ks.ctor === "::") {+ switch (ks._0) {+ case left : --x; break;+ case right: ++x; break;+ case up : ++y; break;+ case down : --y; break;+ }+ ks = ks._1;+ }+ return { _:{}, x:x, y:y };+ }+ return keySignal(f);+ }++ function is(key) { return keySignal(NList.member(key)); }++ var lastPressed = Signal.dropRepeats(downEvents);++ return elm.Native.Keyboard.values = {+ isDown:is,+ directions:F4(dir),+ keysDown:keysDown,+ lastPressed:lastPressed+ };++};+Elm.Native.Mouse = {};+Elm.Native.Mouse.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Mouse = elm.Native.Mouse || {};+ if (elm.Native.Mouse.values) return elm.Native.Mouse.values;++ var Signal = Elm.Signal.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ var position = Signal.constant(Utils.Tuple2(0,0));+ position.defaultNumberOfKids = 2;++ // do not move x and y into Elm. By setting their default number+ // of kids, it is possible to detatch the mouse listeners if+ // they are not needed.+ var x = A2( Signal.lift, function(p){return p._0}, position);+ x.defaultNumberOfKids = 0;+ var y = A2( Signal.lift, function(p){return p._1}, position);+ y.defaultNumberOfKids = 0;++ var isDown = Signal.constant(false);+ var isClicked = Signal.constant(false);+ var clicks = Signal.constant(Utils.Tuple0);++ var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;++ elm.addListener([isClicked.id, clicks.id], node, 'click', function click() {+ elm.notify(isClicked.id, true);+ elm.notify(clicks.id, Utils.Tuple0);+ elm.notify(isClicked.id, false);+ });+ elm.addListener([isDown.id], node, 'mousedown', function down() {+ elm.notify(isDown.id, true);+ });+ elm.addListener([isDown.id], node, 'mouseup', function up() {+ elm.notify(isDown.id, false);+ });+ elm.addListener([position.id], node, 'mousemove', function move(e) {+ elm.notify(position.id, Utils.getXY(e));+ });++ return elm.Native.Mouse.values = {+ position: position,+ x:x,+ y:y,+ isClicked: isClicked,+ isDown: isDown,+ clicks: clicks+ };+};Elm.Native.Random = {};+Elm.Native.Random.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Random = elm.Native.Random || {};+ if (elm.Native.Random.values) return elm.Native.Random.values;++ var Signal = Elm.Signal.make(elm);+ var List = Elm.Native.List.make(elm);++ function range(min, max, signal) {+ function f(x) { return Math.floor(Math.random() * (max-min+1)) + min; }+ return A2( Signal.lift, f, signal );+ }++ function float_(signal) {+ function f(x) { return Math.random(); }+ return A2( Signal.lift, f, signal );+ }++ function floatList(signal) {+ function f(n) {+ if (n < 0) return List.Nil;+ var arr = new Array(n);+ for (var i = n; i--; ) {+ arr[i] = Math.random();+ }+ return List.fromArray(arr);+ }+ return A2( Signal.lift, f, signal );+ }++ return elm.Native.Random.values = {+ range: F3(range),+ float_: float_,+ floatList: floatList+ };++};++Elm.Native.Signal = {};+Elm.Native.Signal.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Signal = elm.Native.Signal || {};+ if (elm.Native.Signal.values) return elm.Native.Signal.values;++ var Utils = Elm.Native.Utils.make(elm);+ var foldr1 = Elm.List.make(elm).foldr1;++ function send(node, timestep, changed) {+ var kids = node.kids;+ for (var i = kids.length; i--; ) {+ kids[i].recv(timestep, changed, node.id);+ }+ }++ function Input(base) {+ this.id = Utils.guid();+ this.value = base;+ this.kids = [];+ this.defaultNumberOfKids = 0;+ this.recv = function(timestep, eid, v) {+ var changed = eid === this.id;+ if (changed) { this.value = v; }+ send(this, timestep, changed);+ return changed;+ };+ elm.inputs.push(this);+ }++ function LiftN(update, args) {+ this.id = Utils.guid();+ this.value = update();+ this.kids = [];++ var n = args.length;+ var count = 0;+ var isChanged = false;++ this.recv = function(timestep, changed, parentID) {+ ++count;+ if (changed) { isChanged = true; }+ if (count == n) {+ if (isChanged) { this.value = update(); }+ send(this, timestep, isChanged);+ isChanged = false;+ count = 0;+ }+ };+ for (var i = n; i--; ) { args[i].kids.push(this); }+ }++ function lift(func, a) {+ function update() { return func(a.value); }+ return new LiftN(update, [a]);+ }+ function lift2(func, a, b) {+ function update() { return A2( func, a.value, b.value ); }+ return new LiftN(update, [a,b]);+ }+ function lift3(func, a, b, c) {+ function update() { return A3( func, a.value, b.value, c.value ); }+ return new LiftN(update, [a,b,c]);+ }+ function lift4(func, a, b, c, d) {+ function update() { return A4( func, a.value, b.value, c.value, d.value ); }+ return new LiftN(update, [a,b,c,d]);+ }+ function lift5(func, a, b, c, d, e) {+ function update() { return A5( func, a.value, b.value, c.value, d.value, e.value ); }+ return new LiftN(update, [a,b,c,d,e]);+ }+ function lift6(func, a, b, c, d, e, f) {+ function update() { return A6( func, a.value, b.value, c.value, d.value, e.value, f.value ); }+ return new LiftN(update, [a,b,c,d,e,f]);+ }+ function lift7(func, a, b, c, d, e, f, g) {+ function update() { return A7( func, a.value, b.value, c.value, d.value, e.value, f.value, g.value ); }+ return new LiftN(update, [a,b,c,d,e,f,g]);+ }+ function lift8(func, a, b, c, d, e, f, g, h) {+ function update() { return A8( func, a.value, b.value, c.value, d.value, e.value, f.value, g.value, h.value ); }+ return new LiftN(update, [a,b,c,d,e,f,g,h]);+ }++ function Foldp(step, state, input) {+ this.id = Utils.guid();+ this.value = state;+ this.kids = [];++ this.recv = function(timestep, changed, parentID) {+ if (changed) {+ this.value = A2( step, input.value, this.value );+ }+ send(this, timestep, changed);+ };+ input.kids.push(this);+ }++ function foldp(step, state, input) {+ return new Foldp(step, state, input);+ }++ function DropIf(pred,base,input) {+ this.id = Utils.guid();+ this.value = pred(input.value) ? base : input.value;+ this.kids = [];+ this.recv = function(timestep, changed, parentID) {+ var chng = changed && !pred(input.value);+ if (chng) { this.value = input.value; }+ send(this, timestep, chng);+ };+ input.kids.push(this);+ }++ function DropRepeats(input) {+ this.id = Utils.guid();+ this.value = input.value;+ this.kids = [];+ this.recv = function(timestep, changed, parentID) {+ var chng = changed && !Utils.eq(this.value,input.value);+ if (chng) { this.value = input.value; }+ send(this, timestep, chng);+ };+ input.kids.push(this);+ }++ function dropWhen(s1,b,s2) {+ var pairs = lift2( F2(function(x,y){return {x:x,y:y};}), s1, s2 );+ var dropped = new DropIf(function(p){return p.x;},{x:true,y:b},pairs);+ return lift(function(p){return p.y;}, dropped);+ }++ function timestamp(a) {+ function update() { return Utils.Tuple2(Date.now(), a.value); }+ return new LiftN(update, [a]);+ }++ function SampleOn(s1,s2) {+ this.id = Utils.guid();+ this.value = s2.value;+ this.kids = [];++ var count = 0;+ var isChanged = false;++ this.recv = function(timestep, changed, parentID) {+ if (parentID === s1.id) isChanged = changed;+ ++count;+ if (count == 2) {+ if (isChanged) { this.value = s2.value; }+ send(this, timestep, isChanged);+ count = 0;+ isChanged = false;+ }+ };+ s1.kids.push(this);+ s2.kids.push(this);+ }++ function sampleOn(s1,s2) { return new SampleOn(s1,s2); }++ function delay(t,s) {+ var delayed = new Input(s.value);+ var firstEvent = true;+ function update(v) {+ if (firstEvent) { firstEvent = false; return; }+ setTimeout(function() { elm.notify(delayed.id, v); }, t);+ }+ function first(a,b) { return a; }+ return new SampleOn(delayed, lift2(F2(first), delayed, lift(update,s)));+ }++ function Merge(s1,s2) {+ this.id = Utils.guid();+ this.value = s1.value;+ this.kids = [];++ var next = null;+ var count = 0;+ var isChanged = false;++ this.recv = function(timestep, changed, parentID) {+ ++count;+ if (changed) {+ isChanged = true;+ if (parentID == s2.id && next === null) { next = s2.value; }+ if (parentID == s1.id) { next = s1.value; }+ }++ if (count == 2) {+ if (isChanged) { this.value = next; next = null; }+ send(this, timestep, isChanged);+ isChanged = false;+ count = 0;+ }+ };+ s1.kids.push(this);+ s2.kids.push(this);+ }++ function merge(s1,s2) { return new Merge(s1,s2); }+ function merges(ss) { return A2(foldr1, F2(merge), ss); }++ return elm.Native.Signal.values = {+ constant : function(v) { return new Input(v); },+ lift : F2(lift ),+ lift2 : F3(lift2),+ lift3 : F4(lift3),+ lift4 : F5(lift4),+ lift5 : F6(lift5),+ lift6 : F7(lift6),+ lift7 : F8(lift7),+ lift8 : F9(lift8),+ foldp : F3(foldp),+ delay : F2(delay),+ merge : F2(merge),+ merges : merges,+ count : function(s) { return foldp(F2(function(_,c) { return c+1; }), 0, s); },+ countIf : F2(function(pred,s) {+ return foldp(F2(function(x,c){+ return pred(x) ? c+1 : c; }), 0, s)}),+ keepIf : F3(function(pred,base,sig) {+ return new DropIf(function(x) {return !pred(x);},base,sig); }),+ dropIf : F3(function(pred,base,sig) { return new DropIf(pred,base,sig); }),+ keepWhen : F3(function(s1,b,s2) {+ return dropWhen(lift(function(b){return !b;},s1), b, s2); }),+ dropWhen : F3(dropWhen),+ dropRepeats : function(s) { return new DropRepeats(s);},+ sampleOn : F2(sampleOn),+ timestamp : timestamp+ };+};+Elm.Native.Time = {};+Elm.Native.Time.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Time = elm.Native.Time || {};+ if (elm.Native.Time.values) return elm.Native.Time.values;++ var Signal = Elm.Signal.make(elm);+ var NS = Elm.Native.Signal.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ function fpsWhen(desiredFPS, isOn) {+ var msPerFrame = 1000 / desiredFPS;+ var prev = Date.now(), curr = prev, diff = 0, wasOn = true;+ var ticker = Signal.constant(diff);+ function tick(zero) { return function() {+ curr = Date.now();+ diff = zero ? 0 : curr - prev;+ prev = curr;+ elm.notify(ticker.id, diff);+ };+ }+ var timeoutID = 0;+ function f(isOn, t) {+ if (isOn) {+ timeoutID = setTimeout(tick(!wasOn && isOn), msPerFrame);+ } else if (wasOn) {+ clearTimeout(timeoutID);+ }+ wasOn = isOn;+ return t;+ }+ return A3( Signal.lift2, F2(f), isOn, ticker );+ }++ function everyWhen(t, isOn) {+ var clock = Signal.constant(Date.now());+ var id = setInterval(function tellTime() {+ if (!elm.notify(clock.id, Date.now())) {+ clearInterval(id);+ }+ }, t);+ return clock;+ }++ function since(t, s) {+ function cmp(a,b) { return !Utils.eq(a,b); }+ var dcount = Signal.count(A2(NS.delay, t, s));+ return A3( Signal.lift2, F2(cmp), Signal.count(s), dcount );+ }+ function read(s) {+ var t = Date.parse(s);+ return isNaN(t) ? Maybe.Nothing : Maybe.Just(t);+ }+ return elm.Native.Time.values = {+ fpsWhen : F2(fpsWhen),+ fps : function(t) { return fpsWhen(t, Signal.constant(true)); },+ every : function(t) { return everyWhen(t, Signal.constant(true)) },+ delay : NS.delay,+ timestamp : NS.timestamp,+ since : F2(since),+ toDate : function(t) { return new window.Date(t); },+ read : read+ };++};+Elm.Native.Touch = {};+Elm.Native.Touch.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Touch = elm.Native.Touch || {};+ if (elm.Native.Touch.values) return elm.Native.Touch.values;++ var Signal = Elm.Signal.make(elm);+ var JS = Elm.JavaScript.make(elm);+ var Utils = Elm.Native.Utils.make(elm);++ function Dict() {+ this.keys = [];+ this.values = [];++ this.insert = function(key,value) {+ this.keys.push(key);+ this.values.push(value);+ };+ this.lookup = function(key) {+ var i = this.keys.indexOf(key)+ return i >= 0 ? this.values[i] : {x:0,y:0,t:0};+ };+ this.remove = function(key) {+ var i = this.keys.indexOf(key);+ if (i < 0) return;+ var t = this.values[i];+ this.keys.splice(i,1);+ this.values.splice(i,1);+ return t;+ };+ this.clear = function() {+ this.keys = [];+ this.values = [];+ };+ }+ + var root = Signal.constant([]),+ tapTime = 500,+ hasTap = false,+ tap = {_:{},x:0,y:0},+ dict = new Dict();++ function touch(t) {+ var r = dict.lookup(t.identifier);+ var point = Utils.getXY(t);+ return {_ : {},+ id: t.identifier,+ x : point._0,+ y : point._1,+ x0: r.x,+ y0: r.y,+ t0: r.t+ };+ }++ var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;++ function start(e) {+ var point = Utils.getXY(e);+ dict.insert(e.identifier,+ {x: point._0,+ y: point._1,+ t: Date.now()});+ }+ function end(e) {+ var t = dict.remove(e.identifier);+ if (Date.now() - t.t < tapTime) {+ hasTap = true;+ tap = {_:{}, x:t.x, y:t.y};+ }+ }++ function listen(name, f) {+ function update(e) {+ for (var i = e.changedTouches.length; i--; ) { f(e.changedTouches[i]); }+ var ts = new Array(e.touches.length);+ for (var i = e.touches.length; i--; ) { ts[i] = touch(e.touches[i]); }+ elm.notify(root.id, ts);+ e.preventDefault();+ }+ elm.addListener([root.id], node, name, update);+ }++ listen("touchstart", start);+ listen("touchmove", function(_){});+ listen("touchend", end);+ listen("touchcancel", end);+ listen("touchleave", end);++ var mouseID = -1;+ function move(e) {+ var point = Utils.getXY(e);+ for (var i = root.value.length; i--; ) {+ if (root.value[i].id === mouseID) {+ root.value[i].x = point._0;+ root.value[i].y = point._1;+ elm.notify(root.id, root.value);+ break;+ }+ }+ }+ elm.addListener([root.id], node, "mousedown", function down(e) {+ node.addEventListener("mousemove", move);+ e.identifier = mouseID;+ start(e);+ root.value.push(touch(e));+ elm.notify(root.id, root.value);+ });+ elm.addListener([root.id], node, "mouseup", function up(e) {+ node.removeEventListener("mousemove", move);+ e.identifier = mouseID;+ end(e);+ for (var i = root.value.length; i--; ) {+ if (root.value[i].id === mouseID) {+ root.value.splice(i, 1);+ --mouseID;+ break;+ }+ }+ elm.notify(root.id, root.value);+ });+ elm.addListener([root.id], node, "blur", function blur(e) {+ node.removeEventListener("mousemove", move);+ if (root.value.length > 0) {+ elm.notify(root.id, []);+ --mouseID;+ }+ dict.clear();+ });++ function dependency(f) {+ var sig = A2( Signal.lift, f, root );+ root.defaultNumberOfKids += 1;+ sig.defaultNumberOfKids = 0;+ return sig;+ }++ var touches = dependency(JS.toList);++ var taps = function() {+ var sig = dependency(function(_) { return tap; });+ sig.defaultNumberOfKids = 1;+ function pred(_) { var b = hasTap; hasTap = false; return b; }+ var sig2 = A3( Signal.keepIf, pred, {_:{},x:0,y:0}, sig);+ sig2.defaultNumberOfKids = 0;+ return sig2;+ }();++ return elm.Native.Touch.values = { touches: touches, taps: taps };++};Elm.Native.WebSocket = {};+Elm.Native.WebSocket.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.WebSocket = elm.Native.WebSocket || {};+ if (elm.Native.WebSocket.values) return elm.Native.WebSocket.values;++ var Signal = Elm.Signal.make(elm);+ var JS = Elm.JavaScript.make(elm);+ var List = Elm.Native.List.make(elm);++ function open(url, outgoing) {+ var incoming = Signal.constant(List.Nil);+ var ws = new WebSocket(JS.fromString(url));++ var pending = [];+ var ready = false;+ + ws.onopen = function(e) {+ var len = pending.length;+ for (var i = 0; i < len; ++i) { ws.send(pending[i]); }+ ready = true;+ };+ ws.onmessage = function(event) {+ elm.notify(incoming.id, JS.toString(event.data));+ };+ + function send(msg) {+ var s = JS.fromString(msg);+ ready ? ws.send(s) : pending.push(s);+ }+ + function take1(x,y) { return x }+ return A3(Signal.lift2, F2(take1), incoming, A2(Signal.lift, send, outgoing));+ }++ return elm.Native.WebSocket.values = { connect: F2(open) };+};+Elm.Native.Window = {};+Elm.Native.Window.make = function(elm) {++ elm.Native = elm.Native || {};+ elm.Native.Window = elm.Native.Window || {};+ if (elm.Native.Window.values) return elm.Native.Window.values;++ var Signal = Elm.Signal.make(elm);+ var Tuple2 = Elm.Native.Utils.make(elm).Tuple2;++ function getWidth() { return elm.node.clientWidth; }+ function getHeight() {+ if (elm.display === ElmRuntime.Display.FULLSCREEN) {+ return window.innerHeight;+ }+ return elm.node.clientHeight;+ }++ var dimensions = Signal.constant(Tuple2(getWidth(), getHeight()));+ dimensions.defaultNumberOfKids = 2;++ // Do not move width and height into Elm. By setting the default number of kids,+ // the resize listener can be detached.+ var width = A2(Signal.lift, function(p){return p._0;}, dimensions);+ width.defaultNumberOfKids = 0;++ var height = A2(Signal.lift, function(p){return p._1;}, dimensions);+ height.defaultNumberOfKids = 0;++ function resizeIfNeeded() {+ var w = getWidth();+ var h = getHeight();+ if (dimensions.value._0 === w && dimensions.value._1 === h) return;+ elm.notify(dimensions.id, Tuple2(w,h));+ }+ elm.addListener([dimensions.id], window, 'resize', resizeIfNeeded);++ return elm.Native.Window.values = {+ dimensions:dimensions,+ width:width,+ height:height,+ resizeIfNeeded:resizeIfNeeded+ };++};+Elm.Automaton = Elm.Automaton || {};+Elm.Automaton.make = function (elm)+ {+ elm.Automaton = elm.Automaton || {};+ if (elm.Automaton.values)+ return elm.Automaton.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Automaton";+ var Basics = Elm.Basics.make(elm);+ var Signal = Elm.Signal.make(elm);+ var List = Elm.List.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var _op = {};+ var enqueue = F2(function (x,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ return {ctor: "_Tuple2", _0: {ctor: "::", _0: x, _1: arg0._0}, _1: arg0._1}}+ _E.Case($moduleName,+ "on line 95, column 22 to 31");+ }()+ });+ var empty = {ctor: "_Tuple2", _0: _J.toList([]), _1: _J.toList([])};+ var dequeue = function (q)+ {+ return function ()+ {+ switch (q.ctor)+ {case+ "_Tuple2" :+ switch (q._0.ctor)+ {case+ "[]" :+ switch (q._1.ctor)+ {case+ "[]" :+ return Maybe.Nothing}+ break;}+ switch (q._1.ctor)+ {case+ "::" :+ return Maybe.Just({ctor: "_Tuple2", _0: q._1._0, _1: {ctor: "_Tuple2", _0: q._0, _1: q._1._1}})+ case+ "[]" :+ return dequeue({ctor: "_Tuple2", _0: _J.toList([]), _1: List.reverse(q._0)})}+ break;}+ _E.Case($moduleName,"between lines 96 and 101");+ }()+ };+ var Step = function (a)+ {+ return {ctor: "Step", _0: a}+ };+ var hiddenState = F2(function (s,f)+ {+ return Step(function (x)+ {+ return function ()+ {+ var $ = A2(f,x,s),+ s$ = $._0,+ out = $._1;+ return {ctor: "_Tuple2", _0: A2(hiddenState,+ s$,+ f), _1: out}+ }()+ })+ });+ var average = function (k)+ {+ return function ()+ {+ var stepFull = F2(function (n,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple3" :+ return function ()+ {+ var _case12 = dequeue(arg0._0);+ switch (_case12.ctor)+ {case+ "Just" :+ switch (_case12._0.ctor)+ {case+ "_Tuple2" :+ return function ()+ {+ var sum$ = arg0._2 + n - _case12._0._0;+ return {ctor: "_Tuple2", _0: {ctor: "_Tuple3", _0: A2(enqueue,+ n,+ _case12._0._1), _1: arg0._1, _2: sum$}, _1: sum$ / Basics.toFloat(arg0._1)}+ }()}+ break;+ case+ "Nothing" :+ return {ctor: "_Tuple2", _0: {ctor: "_Tuple3", _0: arg0._0, _1: arg0._1, _2: arg0._2}, _1: 0}}+ _E.Case($moduleName,+ "between lines 108 and 112");+ }()}+ _E.Case($moduleName,+ "between lines 108 and 112");+ }()+ });+ var step = F2(function (n,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple3" :+ return _N.eq(arg0._1,+ k) ? A2(stepFull,+ n,+ {ctor: "_Tuple3", _0: arg0._0, _1: arg0._1, _2: arg0._2}) : {ctor: "_Tuple2", _0: {ctor: "_Tuple3", _0: A2(enqueue,+ n,+ arg0._0), _1: arg0._1 + 1, _2: arg0._2 + n}, _1: (arg0._2 + n) / (Basics.toFloat(arg0._1) + 1)}}+ _E.Case($moduleName,+ "between lines 105 and 106");+ }()+ });+ return A2(hiddenState,+ {ctor: "_Tuple3", _0: empty, _1: 0, _2: 0},+ step)+ }()+ };+ var pure = function (f)+ {+ return Step(function (x)+ {+ return {ctor: "_Tuple2", _0: pure(f), _1: f(x)}+ })+ };+ var run = F3(function (auto,base,inputs)+ {+ return function ()+ {+ var step = F2(function (a,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ switch (arg0._0.ctor)+ {case+ "Step" :+ return arg0._0._0(a)}+ break;}+ _E.Case($moduleName,+ "on line 35, column 28 to 31");+ }()+ });+ return A2(Signal.lift,+ function (arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ return arg0._1}+ _E.Case($moduleName,+ "on line 36, column 23 to 24");+ }()+ },+ A3(Signal.foldp,+ step,+ {ctor: "_Tuple2", _0: auto, _1: base},+ inputs))+ }()+ });+ var state = F2(function (s,f)+ {+ return Step(function (x)+ {+ return function ()+ {+ var s$ = A2(f,x,s);+ return {ctor: "_Tuple2", _0: A2(state,+ s$,+ f), _1: s$}+ }()+ })+ });+ var count = A2(state,+ 0,+ F2(function (arg1,c)+ {+ return function ()+ {+ return c + 1+ }()+ }));+ var step = F2(function (a,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "Step" :+ return arg0._0(a)}+ _E.Case($moduleName,"on line 40, column 19 to 22");+ }()+ });+ var combine = function (autos)+ {+ return Step(function (a)+ {+ return function ()+ {+ var $ = List.unzip(A2(List.map,+ step(a),+ autos)),+ autos$ = $._0,+ bs = $._1;+ return {ctor: "_Tuple2", _0: combine(autos$), _1: bs}+ }()+ })+ };+ _op[">>>"] = F2(function (f,g)+ {+ return Step(function (a)+ {+ return function ()+ {+ var $ = A2(step,a,f),+ f$ = $._0,+ b = $._1;+ var $ = A2(step,b,g),+ g$ = $._0,+ c = $._1;+ return {ctor: "_Tuple2", _0: A2(_op[">>>"],+ f$,+ g$), _1: c}+ }()+ })+ });+ _op["<<<"] = F2(function (g,f)+ {+ return A2(_op[">>>"],f,g)+ });+ elm.Automaton.values = {_op: _op, pure: pure, state: state, hiddenState: hiddenState, run: run, step: step, combine: combine, count: count, average: average};+ return elm.Automaton.values+ };Elm.Basics = Elm.Basics || {};+Elm.Basics.make = function (elm)+ {+ elm.Basics = elm.Basics || {};+ if (elm.Basics.values)+ return elm.Basics.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Basics";+ var Native = Native || {};+ Native.Basics = Elm.Native.Basics.make(elm);+ var _op = {};+ _op["||"] = Native.Basics.or;+ _op["|>"] = F2(function (x,f)+ {+ return f(x)+ });+ var xor = Native.Basics.xor;+ var uncurry = Native.Basics.uncurry;+ var truncate = Native.Basics.truncate;+ var toFloat = Native.Basics.toFloat;+ var tan = Native.Basics.tan;+ var sqrt = Native.Basics.sqrt;+ var snd = Native.Basics.snd;+ var sin = Native.Basics.sin;+ var round = Native.Basics.round;+ var rem = Native.Basics.rem;+ var radians = function (t)+ {+ return t+ };+ var pi = Native.Basics.pi;+ var otherwise = true;+ var not = Native.Basics.not;+ var mod = Native.Basics.mod;+ var min = Native.Basics.min;+ var max = Native.Basics.max;+ var logBase = Native.Basics.logBase;+ var id = function (x)+ {+ return x+ };+ var fst = Native.Basics.fst;+ var floor = Native.Basics.floor;+ var flip = F3(function (f,b,a)+ {+ return A2(f,a,b)+ });+ var e = Native.Basics.e;+ var div = Native.Basics.div;+ var curry = Native.Basics.curry;+ var cos = Native.Basics.cos;+ var compare = Native.Basics.compare;+ var clamp = Native.Basics.clamp;+ var ceiling = Native.Basics.ceiling;+ var atan2 = Native.Basics.atan2;+ var atan = Native.Basics.atan;+ var asin = Native.Basics.asin;+ var acos = Native.Basics.acos;+ var abs = Native.Basics.abs;+ _op["^"] = Native.Basics.exp;+ var LT = {ctor: "LT"};+ var GT = {ctor: "GT"};+ var EQ = {ctor: "EQ"};+ _op[">="] = Native.Basics.ge;+ _op[">"] = Native.Basics.gt;+ _op["=="] = Native.Basics.eq;+ _op["<|"] = F2(function (f,x)+ {+ return f(x)+ });+ _op["<="] = Native.Basics.le;+ _op["<"] = Native.Basics.lt;+ _op["/="] = Native.Basics.neq;+ _op["/"] = Native.Basics.floatDiv;+ _op["."] = F3(function (f,g,x)+ {+ return f(g(x))+ });+ _op["-"] = Native.Basics.sub;+ _op["+"] = Native.Basics.add;+ var toPolar = function (arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ return {ctor: "_Tuple2", _0: Native.Basics.sqrt(Math.pow(arg0._0,+ 2) + Math.pow(arg0._1,+ 2)), _1: A2(Native.Basics.atan2,+ arg0._1,+ arg0._0)}}+ _E.Case($moduleName,"on line 76, column 18 to 73");+ }()+ };+ _op["*"] = Native.Basics.mul;+ var degrees = function (d)+ {+ return d * Native.Basics.pi / 180+ };+ var fromPolar = function (arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ return {ctor: "_Tuple2", _0: arg0._0 * Native.Basics.cos(arg0._1), _1: arg0._0 * Native.Basics.sin(arg0._1)}}+ _E.Case($moduleName,"on line 70, column 20 to 68");+ }()+ };+ var turns = function (r)+ {+ return 2 * Native.Basics.pi * r+ };+ _op["&&"] = Native.Basics.and;+ elm.Basics.values = {_op: _op, radians: radians, degrees: degrees, turns: turns, fromPolar: fromPolar, toPolar: toPolar, div: div, rem: rem, mod: mod, cos: cos, sin: sin, tan: tan, acos: acos, asin: asin, atan: atan, atan2: atan2, sqrt: sqrt, abs: abs, logBase: logBase, clamp: clamp, pi: pi, e: e, compare: compare, min: min, max: max, xor: xor, not: not, otherwise: otherwise, round: round, truncate: truncate, floor: floor, ceiling: ceiling, toFloat: toFloat, id: id, fst: fst, snd: snd, flip: flip, curry: curry, uncurry: uncurry, LT: LT, EQ: EQ, GT: GT};+ return elm.Basics.values+ };Elm.Char = Elm.Char || {};+Elm.Char.make = function (elm)+ {+ elm.Char = elm.Char || {};+ if (elm.Char.values)+ return elm.Char.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Char";+ var Native = Native || {};+ Native.Char = Elm.Native.Char.make(elm);+ var _op = {};+ var toUpper = Native.Char.toUpper;+ var toLower = Native.Char.toLower;+ var toLocaleUpper = Native.Char.toLocaleUpper;+ var toLocaleLower = Native.Char.toLocaleLower;+ var toCode = Native.Char.toCode;+ var isUpper = Native.Char.isUpper;+ var isOctDigit = Native.Char.isOctDigit;+ var isLower = Native.Char.isLower;+ var isHexDigit = Native.Char.isHexDigit;+ var isDigit = Native.Char.isDigit;+ var fromCode = Native.Char.fromCode;+ elm.Char.values = {_op: _op, isUpper: isUpper, isLower: isLower, isDigit: isDigit, isOctDigit: isOctDigit, isHexDigit: isHexDigit, toUpper: toUpper, toLower: toLower, toLocaleUpper: toLocaleUpper, toLocaleLower: toLocaleLower, toCode: toCode, fromCode: fromCode};+ return elm.Char.values+ };Elm.Color = Elm.Color || {};+Elm.Color.make = function (elm)+ {+ elm.Color = elm.Color || {};+ if (elm.Color.values)+ return elm.Color.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Color";+ var Native = Native || {};+ Native.Color = Elm.Native.Color.make(elm);+ var Basics = Elm.Basics.make(elm);+ var _op = {};+ var hsva = Native.Color.hsva;+ var hsv = Native.Color.hsv;+ var greyscale = function (p)+ {+ return A3(hsv,0,0,1 - p)+ };+ var grayscale = function (p)+ {+ return A3(hsv,0,0,1 - p)+ };+ var complement = Native.Color.complement;+ var Radial = F5(function (a,b,c,d,e)+ {+ return {ctor: "Radial", _0: a, _1: b, _2: c, _3: d, _4: e}+ });+ var radial = Radial;+ var Linear = F3(function (a,b,c)+ {+ return {ctor: "Linear", _0: a, _1: b, _2: c}+ });+ var linear = Linear;+ var Color = F4(function (a,b,c,d)+ {+ return {ctor: "Color", _0: a, _1: b, _2: c, _3: d}+ });+ var black = A4(Color,0,0,0,1);+ var blue = A4(Color,52,101,164,1);+ var brown = A4(Color,193,125,17,1);+ var charcoal = A4(Color,85,87,83,1);+ var darkBlue = A4(Color,32,74,135,1);+ var darkBrown = A4(Color,143,89,2,1);+ var darkCharcoal = A4(Color,46,52,54,1);+ var darkGray = A4(Color,186,189,182,1);+ var darkGreen = A4(Color,78,154,6,1);+ var darkGrey = A4(Color,186,189,182,1);+ var darkOrange = A4(Color,206,92,0,1);+ var darkPurple = A4(Color,92,53,102,1);+ var darkRed = A4(Color,164,0,0,1);+ var darkYellow = A4(Color,196,160,0,1);+ var gray = A4(Color,211,215,207,1);+ var green = A4(Color,115,210,22,1);+ var grey = A4(Color,211,215,207,1);+ var lightBlue = A4(Color,114,159,207,1);+ var lightBrown = A4(Color,233,185,110,1);+ var lightCharcoal = A4(Color,136,138,133,1);+ var lightGray = A4(Color,238,238,236,1);+ var lightGreen = A4(Color,138,226,52,1);+ var lightGrey = A4(Color,238,238,236,1);+ var lightOrange = A4(Color,252,175,62,1);+ var lightPurple = A4(Color,173,127,168,1);+ var lightRed = A4(Color,239,41,41,1);+ var lightYellow = A4(Color,255,233,79,1);+ var orange = A4(Color,245,121,0,1);+ var purple = A4(Color,117,80,123,1);+ var red = A4(Color,204,0,0,1);+ var rgb = F3(function (r,g,b)+ {+ return A4(Color,r,g,b,1)+ });+ var rgba = Color;+ var white = A4(Color,255,255,255,1);+ var yellow = A4(Color,237,212,0,1);+ elm.Color.values = {_op: _op, rgba: rgba, rgb: rgb, lightRed: lightRed, red: red, darkRed: darkRed, lightOrange: lightOrange, orange: orange, darkOrange: darkOrange, lightYellow: lightYellow, yellow: yellow, darkYellow: darkYellow, lightGreen: lightGreen, green: green, darkGreen: darkGreen, lightBlue: lightBlue, blue: blue, darkBlue: darkBlue, lightPurple: lightPurple, purple: purple, darkPurple: darkPurple, lightBrown: lightBrown, brown: brown, darkBrown: darkBrown, black: black, white: white, lightGrey: lightGrey, grey: grey, darkGrey: darkGrey, lightGray: lightGray, gray: gray, darkGray: darkGray, lightCharcoal: lightCharcoal, charcoal: charcoal, darkCharcoal: darkCharcoal, grayscale: grayscale, greyscale: greyscale, complement: complement, hsva: hsva, hsv: hsv, linear: linear, radial: radial, Color: Color, Linear: Linear, Radial: Radial};+ return elm.Color.values+ };Elm.Date = Elm.Date || {};+Elm.Date.make = function (elm)+ {+ elm.Date = elm.Date || {};+ if (elm.Date.values)+ return elm.Date.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Date";+ var Native = Native || {};+ Native.Date = Elm.Native.Date.make(elm);+ var Time = Elm.Time.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var _op = {};+ var year = Native.Date.year;+ var toTime = Native.Date.toTime;+ var second = Native.Date.second;+ var read = Native.Date.read;+ var month = Native.Date.month;+ var minute = Native.Date.minute;+ var hour = Native.Date.hour;+ var dayOfWeek = Native.Date.dayOfWeek;+ var day = Native.Date.day;+ var Wed = {ctor: "Wed"};+ var Tue = {ctor: "Tue"};+ var Thu = {ctor: "Thu"};+ var Sun = {ctor: "Sun"};+ var Sep = {ctor: "Sep"};+ var Sat = {ctor: "Sat"};+ var Oct = {ctor: "Oct"};+ var Nov = {ctor: "Nov"};+ var Mon = {ctor: "Mon"};+ var May = {ctor: "May"};+ var Mar = {ctor: "Mar"};+ var Jun = {ctor: "Jun"};+ var Jul = {ctor: "Jul"};+ var Jan = {ctor: "Jan"};+ var Fri = {ctor: "Fri"};+ var Feb = {ctor: "Feb"};+ var Dec = {ctor: "Dec"};+ var Date = {ctor: "Date"};+ var Aug = {ctor: "Aug"};+ var Apr = {ctor: "Apr"};+ elm.Date.values = {_op: _op, read: read, toTime: toTime, year: year, month: month, day: day, dayOfWeek: dayOfWeek, hour: hour, minute: minute, second: second, Date: Date, Mon: Mon, Tue: Tue, Wed: Wed, Thu: Thu, Fri: Fri, Sat: Sat, Sun: Sun, Jan: Jan, Feb: Feb, Mar: Mar, Apr: Apr, May: May, Jun: Jun, Jul: Jul, Aug: Aug, Sep: Sep, Oct: Oct, Nov: Nov, Dec: Dec};+ return elm.Date.values+ };Elm.Dict = Elm.Dict || {};+Elm.Dict.make = function (elm)+ {+ elm.Dict = elm.Dict || {};+ if (elm.Dict.values)+ return elm.Dict.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Dict";+ var Basics = Elm.Basics.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var Native = Native || {};+ Native.Error = Elm.Native.Error.make(elm);+ var List = Elm.List.make(elm);+ var Native = Native || {};+ Native.Utils = Elm.Native.Utils.make(elm);+ var _op = {};+ var Red = {ctor: "Red"};+ var RBNode = F5(function (a,b,c,d,e)+ {+ return {ctor: "RBNode", _0: a, _1: b, _2: c, _3: d, _4: e}+ });+ var rotateLeft = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ return A5(RBNode,+ t._0,+ t._4._1,+ t._4._2,+ A5(RBNode,Red,t._1,t._2,t._3,t._4._3),+ t._4._4)}+ break;}+ return Native.Error.raise("rotateLeft of a node without enough children")+ }()+ };+ var rotateLeftIfNeeded = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ switch (t._4._0.ctor)+ {case+ "Red" :+ return rotateLeft(t)}+ break;}+ break;}+ return t+ }()+ };+ var rotateRight = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBNode" :+ return A5(RBNode,+ t._0,+ t._3._1,+ t._3._2,+ t._3._3,+ A5(RBNode,+ Red,+ t._1,+ t._2,+ t._3._4,+ t._4))}+ break;}+ return Native.Error.raise("rotateRight of a node without enough children")+ }()+ };+ var rotateRightIfNeeded = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBNode" :+ switch (t._3._0.ctor)+ {case+ "Red" :+ switch (t._3._3.ctor)+ {case+ "RBNode" :+ switch (t._3._3._0.ctor)+ {case+ "Red" :+ return rotateRight(t)}+ break;}+ break;}+ break;}+ break;}+ return t+ }()+ };+ var RBEmpty = function (a)+ {+ return {ctor: "RBEmpty", _0: a}+ };+ var max = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return Native.Error.raise("(max Empty) is not defined")+ case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBEmpty" :+ return {ctor: "_Tuple2", _0: t._1, _1: t._2}}+ return max(t._4)}+ _E.Case($moduleName,"between lines 63 and 68");+ }()+ };+ var redden = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return Native.Error.raise("can\'t make a Leaf red")+ case+ "RBNode" :+ return A5(RBNode,Red,t._1,t._2,t._3,t._4)}+ _E.Case($moduleName,"between lines 285 and 290");+ }()+ };+ var NBlack = {ctor: "NBlack"};+ var LBlack = {ctor: "LBlack"};+ var empty = RBEmpty(LBlack);+ var findWithDefault = F3(function (base,k,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return base}+ break;+ case+ "RBNode" :+ return function ()+ {+ var _case71 = A2(Native.Utils.compare,+ k,+ t._1);+ switch (_case71.ctor)+ {case+ "EQ" :+ return t._2+ case+ "GT" :+ return A3(findWithDefault,+ base,+ k,+ t._4)+ case+ "LT" :+ return A3(findWithDefault,+ base,+ k,+ t._3)}+ _E.Case($moduleName,+ "between lines 86 and 91");+ }()}+ _E.Case($moduleName,+ "between lines 83 and 91");+ }()+ });+ var foldl = F3(function (f,acc,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return acc}+ break;+ case+ "RBNode" :+ return A3(foldl,+ f,+ A3(f,t._1,t._2,A3(foldl,f,acc,t._3)),+ t._4)}+ _E.Case($moduleName,"between lines 305 and 310");+ }()+ });+ var foldr = F3(function (f,acc,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return acc}+ break;+ case+ "RBNode" :+ return A3(foldr,+ f,+ A3(f,t._1,t._2,A3(foldr,f,acc,t._4)),+ t._3)}+ _E.Case($moduleName,"between lines 313 and 318");+ }()+ });+ var keys = function (t)+ {+ return A3(foldr,+ F3(function (k,v,acc)+ {+ return {ctor: "::", _0: k, _1: acc}+ }),+ _J.toList([]),+ t)+ };+ var toList = function (t)+ {+ return A3(foldr,+ F3(function (k,v,acc)+ {+ return {ctor: "::", _0: {ctor: "_Tuple2", _0: k, _1: v}, _1: acc}+ }),+ _J.toList([]),+ t)+ };+ var values = function (t)+ {+ return A3(foldr,+ F3(function (k,v,acc)+ {+ return {ctor: "::", _0: v, _1: acc}+ }),+ _J.toList([]),+ t)+ };+ var lookup = F2(function (k,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return Maybe.Nothing}+ break;+ case+ "RBNode" :+ return function ()+ {+ var _case93 = A2(Native.Utils.compare,+ k,+ t._1);+ switch (_case93.ctor)+ {case+ "EQ" :+ return Maybe.Just(t._2)+ case+ "GT" :+ return A2(lookup,k,t._4)+ case+ "LT" :+ return A2(lookup,k,t._3)}+ _E.Case($moduleName,+ "between lines 74 and 80");+ }()}+ _E.Case($moduleName,"between lines 71 and 80");+ }()+ });+ var member = F2(function (k,t)+ {+ return Maybe.isJust(A2(lookup,k,t))+ });+ var map = F2(function (f,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return RBEmpty(LBlack)}+ break;+ case+ "RBNode" :+ return A5(RBNode,+ t._0,+ t._1,+ f(t._2),+ A2(map,f,t._3),+ A2(map,f,t._4))}+ _E.Case($moduleName,"between lines 297 and 302");+ }()+ });+ var min = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return Native.Error.raise("(min Empty) is not defined")}+ break;+ case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBEmpty" :+ switch (t._3._0.ctor)+ {case+ "LBlack" :+ return {ctor: "_Tuple2", _0: t._1, _1: t._2}}+ break;}+ return min(t._3)}+ _E.Case($moduleName,"between lines 56 and 59");+ }()+ };+ var LBBlack = {ctor: "LBBlack"};+ var Black = {ctor: "Black"};+ var blacken = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return RBEmpty(LBlack)+ case+ "RBNode" :+ return A5(RBNode,Black,t._1,t._2,t._3,t._4)}+ _E.Case($moduleName,"between lines 279 and 281");+ }()+ };+ var ensureBlackRoot = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return t}+ break;+ case+ "RBNode" :+ switch (t._0.ctor)+ {case+ "Black" :+ return t+ case+ "Red" :+ return A5(RBNode,+ Black,+ t._1,+ t._2,+ t._3,+ t._4)}+ break;}+ _E.Case($moduleName,"between lines 143 and 149");+ }()+ };+ var otherColor = function (c)+ {+ return function ()+ {+ switch (c.ctor)+ {case+ "Black" :+ return Red+ case+ "Red" :+ return Black}+ _E.Case($moduleName,"on line 122, column 16 to 57");+ }()+ };+ var color_flip = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ return A5(RBNode,+ otherColor(t._0),+ t._1,+ t._2,+ A5(RBNode,+ otherColor(t._3._0),+ t._3._1,+ t._3._2,+ t._3._3,+ t._3._4),+ A5(RBNode,+ otherColor(t._4._0),+ t._4._1,+ t._4._2,+ t._4._3,+ t._4._4))}+ break;}+ break;}+ return Native.Error.raise("color_flip called on a Empty or Node with a Empty child")+ }()+ };+ var color_flipIfNeeded = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBNode" :+ switch (t._3._0.ctor)+ {case+ "Red" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ switch (t._4._0.ctor)+ {case+ "Red" :+ return color_flip(t)}+ break;}+ break;}+ break;}+ break;}+ return t+ }()+ };+ var fixUp = function (t)+ {+ return color_flipIfNeeded(rotateRightIfNeeded(rotateLeftIfNeeded(t)))+ };+ var insert = F3(function (k,v,t)+ {+ return function ()+ {+ var ins = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBlack" :+ return A5(RBNode,+ Red,+ k,+ v,+ RBEmpty(LBlack),+ RBEmpty(LBlack))}+ break;+ case+ "RBNode" :+ return function ()+ {+ var h = function ()+ {+ var _case163 = A2(Native.Utils.compare,+ k,+ t._1);+ switch (_case163.ctor)+ {case+ "EQ" :+ return A5(RBNode,+ t._0,+ t._1,+ v,+ t._3,+ t._4)+ case+ "GT" :+ return A5(RBNode,+ t._0,+ t._1,+ t._2,+ t._3,+ ins(t._4))+ case+ "LT" :+ return A5(RBNode,+ t._0,+ t._1,+ t._2,+ ins(t._3),+ t._4)}+ _E.Case($moduleName,+ "between lines 156 and 160");+ }();+ return fixUp(h)+ }()}+ _E.Case($moduleName,+ "between lines 153 and 161");+ }()+ };+ return ensureBlackRoot(ins(t))+ }()+ });+ var fromList = function (assocs)+ {+ return A3(List.foldl,+ F2(function (arg1,d)+ {+ return function ()+ {+ switch (arg1.ctor)+ {case+ "_Tuple2" :+ return A3(insert,arg1._0,arg1._1,d)}+ _E.Case($moduleName,+ "on line 348, column 43 to 55");+ }()+ }),+ empty,+ assocs)+ };+ var intersect = F2(function (t1,t2)+ {+ return function ()+ {+ var combine = F3(function (k,v,t)+ {+ return A2(member,+ k,+ t2) ? A3(insert,+ k,+ v,+ t) : t+ });+ return A3(foldl,combine,empty,t1)+ }()+ });+ var singleton = F2(function (k,v)+ {+ return A3(insert,k,v,RBEmpty(LBlack))+ });+ var union = F2(function (t1,t2)+ {+ return A3(foldl,insert,t2,t1)+ });+ var BBlack = {ctor: "BBlack"};+ var blackish = function (arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "RBNode" :+ return _N.eq(arg0._0,Black) || _N.eq(arg0._0,BBlack)}+ _E.Case($moduleName,"on line 243, column 31 to 56");+ }()+ };+ var isBBlack = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ switch (t._0.ctor)+ {case+ "LBBlack" :+ return true}+ break;+ case+ "RBNode" :+ return function ()+ {+ switch (t._0.ctor)+ {case+ "BBlack" :+ return true}+ return false+ }()}+ return false+ }()+ };+ var lessBlack = function (c)+ {+ return function ()+ {+ switch (c.ctor)+ {case+ "BBlack" :+ return Black+ case+ "Black" :+ return Red+ case+ "NBlack" :+ return NBlack+ case+ "Red" :+ return NBlack}+ _E.Case($moduleName,"between lines 185 and 189");+ }()+ };+ var balance_node = function (t)+ {+ return function ()+ {+ var assemble = function (col)+ {+ return function (xk)+ {+ return function (xv)+ {+ return function (yk)+ {+ return function (yv)+ {+ return function (zk)+ {+ return function (zv)+ {+ return function (a)+ {+ return function (b)+ {+ return function (c)+ {+ return function (d)+ {+ return A5(RBNode,+ lessBlack(col),+ yk,+ yv,+ A5(RBNode,+ Black,+ xk,+ xv,+ a,+ b),+ A5(RBNode,+ Black,+ zk,+ zv,+ c,+ d))+ }+ }+ }+ }+ }+ }+ }+ }+ }+ }+ };+ return blackish(t) ? function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBNode" :+ switch (t._3._0.ctor)+ {case+ "Red" :+ switch (t._3._3.ctor)+ {case+ "RBNode" :+ switch (t._3._3._0.ctor)+ {case+ "Red" :+ return assemble(t._0)(t._3._3._1)(t._3._3._2)(t._3._1)(t._3._2)(t._1)(t._2)(t._3._3._3)(t._3._3._4)(t._3._4)(t._4)}+ break;}+ switch (t._3._4.ctor)+ {case+ "RBNode" :+ switch (t._3._4._0.ctor)+ {case+ "Red" :+ return assemble(t._0)(t._3._1)(t._3._2)(t._3._4._1)(t._3._4._2)(t._1)(t._2)(t._3._3)(t._3._4._3)(t._3._4._4)(t._4)}+ break;}+ break;}+ break;}+ switch (t._4.ctor)+ {case+ "RBNode" :+ switch (t._4._0.ctor)+ {case+ "Red" :+ switch (t._4._3.ctor)+ {case+ "RBNode" :+ switch (t._4._3._0.ctor)+ {case+ "Red" :+ return assemble(t._0)(t._1)(t._2)(t._4._3._1)(t._4._3._2)(t._4._1)(t._4._2)(t._3)(t._4._3._3)(t._4._3._4)(t._4._4)}+ break;}+ switch (t._4._4.ctor)+ {case+ "RBNode" :+ switch (t._4._4._0.ctor)+ {case+ "Red" :+ return assemble(t._0)(t._1)(t._2)(t._4._1)(t._4._2)(t._4._4._1)(t._4._4._2)(t._3)(t._4._3)(t._4._4._3)(t._4._4._4)}+ break;}+ break;}+ break;}+ switch (t._0.ctor)+ {case+ "BBlack" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ switch (t._4._0.ctor)+ {case+ "NBlack" :+ switch (t._4._3.ctor)+ {case+ "RBNode" :+ switch (t._4._3._0.ctor)+ {case+ "Black" :+ return function ()+ {+ switch (t._4._4.ctor)+ {case+ "RBNode" :+ switch (t._4._4._0.ctor)+ {case+ "Black" :+ return A5(RBNode,+ Black,+ t._4._3._1,+ t._4._3._2,+ A5(RBNode,+ Black,+ t._1,+ t._2,+ t._3,+ t._4._3._3),+ A5(balance,+ Black,+ t._4._1,+ t._4._2,+ t._4._3._4,+ redden(t._4._4)))}+ break;}+ return t+ }()}+ break;}+ break;}+ break;}+ switch (t._3.ctor)+ {case+ "RBNode" :+ switch (t._3._0.ctor)+ {case+ "NBlack" :+ switch (t._3._4.ctor)+ {case+ "RBNode" :+ switch (t._3._4._0.ctor)+ {case+ "Black" :+ return function ()+ {+ switch (t._3._3.ctor)+ {case+ "RBNode" :+ switch (t._3._3._0.ctor)+ {case+ "Black" :+ return A5(RBNode,+ Black,+ t._3._4._1,+ t._3._4._2,+ A5(balance,+ Black,+ t._3._1,+ t._3._2,+ redden(t._3._3),+ t._3._4._3),+ A5(RBNode,+ Black,+ t._1,+ t._2,+ t._3._4._4,+ t._4))}+ break;}+ return t+ }()}+ break;}+ break;}+ break;}+ break;}+ break;}+ return t+ }() : t+ }()+ };+ var balance = F5(function (c,k,v,l,r)+ {+ return balance_node(A5(RBNode,c,k,v,l,r))+ });+ var lessBlackTree = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return RBEmpty(LBlack)+ case+ "RBNode" :+ return A5(RBNode,+ lessBlack(t._0),+ t._1,+ t._2,+ t._3,+ t._4)}+ _E.Case($moduleName,"between lines 197 and 199");+ }()+ };+ var moreBlack = function (c)+ {+ return function ()+ {+ switch (c.ctor)+ {case+ "BBlack" :+ return BBlack+ case+ "Black" :+ return BBlack+ case+ "NBlack" :+ return Red+ case+ "Red" :+ return Black}+ _E.Case($moduleName,"between lines 179 and 183");+ }()+ };+ var bubble = F5(function (c,k,v,l,r)+ {+ return isBBlack(l) || isBBlack(r) ? A5(balance,+ moreBlack(c),+ k,+ v,+ lessBlackTree(l),+ lessBlackTree(r)) : A5(RBNode,+ c,+ k,+ v,+ l,+ r)+ });+ var remove_max = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBEmpty" :+ return rem(t)}+ return A5(bubble,+ t._0,+ t._1,+ t._2,+ t._3,+ remove_max(t._4))}+ _E.Case($moduleName,"between lines 234 and 236");+ }()+ };+ var rem = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBNode" :+ switch (t._3.ctor)+ {case+ "RBEmpty" :+ switch (t._4.ctor)+ {case+ "RBEmpty" :+ return function ()+ {+ switch (t._0.ctor)+ {case+ "Black" :+ return RBEmpty(LBBlack)+ case+ "Red" :+ return RBEmpty(LBlack)}+ _E.Case($moduleName,+ "between lines 213 and 216");+ }()}+ break;}+ switch (t._0.ctor)+ {case+ "Black" :+ switch (t._3.ctor)+ {case+ "RBEmpty" :+ switch (t._4.ctor)+ {case+ "RBNode" :+ return A5(RBNode,+ Black,+ t._4._1,+ t._4._2,+ t._4._3,+ t._4._4)}+ break;+ case+ "RBNode" :+ switch (t._4.ctor)+ {case+ "RBEmpty" :+ return A5(RBNode,+ Black,+ t._3._1,+ t._3._2,+ t._3._3,+ t._3._4)}+ break;}+ break;}+ return function ()+ {+ var l$ = remove_max(t._3);+ var $ = max(t._3),k = $._0,v = $._1;+ return A5(bubble,t._0,k,v,l$,t._4)+ }()}+ _E.Case($moduleName,"between lines 212 and 224");+ }()+ };+ var del = F2(function (k,t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return t+ case+ "RBNode" :+ return function ()+ {+ var _case293 = A2(Native.Utils.compare,+ k,+ t._1);+ switch (_case293.ctor)+ {case+ "EQ" :+ return rem(t)+ case+ "GT" :+ return A5(bubble,+ t._0,+ t._1,+ t._2,+ t._3,+ A2(del,k,t._4))+ case+ "LT" :+ return A5(bubble,+ t._0,+ t._1,+ t._2,+ A2(del,k,t._3),+ t._4)}+ _E.Case($moduleName,+ "between lines 205 and 208");+ }()}+ _E.Case($moduleName,"between lines 203 and 208");+ }()+ });+ var remove = F2(function (k,t)+ {+ return blacken(A2(del,k,t))+ });+ var diff = F2(function (t1,t2)+ {+ return A3(foldl,+ F3(function (k,v,t)+ {+ return A2(remove,k,t)+ }),+ t1,+ t2)+ });+ var moreBlackTree = function (t)+ {+ return function ()+ {+ switch (t.ctor)+ {case+ "RBEmpty" :+ return RBEmpty(LBBlack)+ case+ "RBNode" :+ return A5(RBNode,+ moreBlack(t._0),+ t._1,+ t._2,+ t._3,+ t._4)}+ _E.Case($moduleName,"between lines 192 and 194");+ }()+ };+ elm.Dict.values = {_op: _op, empty: empty, singleton: singleton, insert: insert, lookup: lookup, findWithDefault: findWithDefault, remove: remove, member: member, foldl: foldl, foldr: foldr, map: map, union: union, intersect: intersect, diff: diff, keys: keys, values: values, toList: toList, fromList: fromList};+ return elm.Dict.values+ };Elm.Either = Elm.Either || {};+Elm.Either.make = function (elm)+ {+ elm.Either = elm.Either || {};+ if (elm.Either.values)+ return elm.Either.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Either";+ var List = Elm.List.make(elm);+ var _op = {};+ var Right = function (a)+ {+ return {ctor: "Right", _0: a}+ };+ var isRight = function (e)+ {+ return function ()+ {+ switch (e.ctor)+ {case+ "Right" :+ return true}+ return false+ }()+ };+ var Left = function (a)+ {+ return {ctor: "Left", _0: a}+ };+ var consEither = F2(function (e,arg0)+ {+ return function ()+ {+ switch (arg0.ctor)+ {case+ "_Tuple2" :+ return function ()+ {+ switch (e.ctor)+ {case+ "Left" :+ return {ctor: "_Tuple2", _0: {ctor: "::", _0: e._0, _1: arg0._0}, _1: arg0._1}+ case+ "Right" :+ return {ctor: "_Tuple2", _0: arg0._0, _1: {ctor: "::", _0: e._0, _1: arg0._1}}}+ _E.Case($moduleName,+ "between lines 66 and 68");+ }()}+ _E.Case($moduleName,"between lines 66 and 68");+ }()+ });+ var partition = function (es)+ {+ return A3(List.foldr,+ consEither,+ {ctor: "_Tuple2", _0: _J.toList([]), _1: _J.toList([])},+ es)+ };+ var consLeft = F2(function (e,vs)+ {+ return function ()+ {+ switch (e.ctor)+ {case+ "Left" :+ return {ctor: "::", _0: e._0, _1: vs}+ case+ "Right" :+ return vs}+ _E.Case($moduleName,"between lines 56 and 58");+ }()+ });+ var lefts = function (es)+ {+ return A3(List.foldr,consLeft,_J.toList([]),es)+ };+ var consRight = F2(function (e,vs)+ {+ return function ()+ {+ switch (e.ctor)+ {case+ "Left" :+ return vs+ case+ "Right" :+ return {ctor: "::", _0: e._0, _1: vs}}+ _E.Case($moduleName,"between lines 61 and 63");+ }()+ });+ var rights = function (es)+ {+ return A3(List.foldr,consRight,_J.toList([]),es)+ };+ var either = F3(function (f,g,e)+ {+ return function ()+ {+ switch (e.ctor)+ {case+ "Left" :+ return f(e._0)+ case+ "Right" :+ return g(e._0)}+ _E.Case($moduleName,"on line 31, column 16 to 60");+ }()+ });+ var isLeft = function (e)+ {+ return function ()+ {+ switch (e.ctor)+ {case+ "Left" :+ return true}+ return false+ }()+ };+ elm.Either.values = {_op: _op, either: either, isLeft: isLeft, isRight: isRight, lefts: lefts, rights: rights, partition: partition, consLeft: consLeft, consRight: consRight, consEither: consEither, Left: Left, Right: Right};+ return elm.Either.values+ };Elm.Http = Elm.Http || {};+Elm.Http.make = function (elm)+ {+ elm.Http = elm.Http || {};+ if (elm.Http.values)+ return elm.Http.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Http";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Http = Elm.Native.Http.make(elm);+ var _op = {};+ var send = Native.Http.send;+ var Waiting = {ctor: "Waiting"};+ var Success = function (a)+ {+ return {ctor: "Success", _0: a}+ };+ var Request = F4(function (a,b,c,d)+ {+ return {_: {}, body: c, headers: d, url: b, verb: a}+ });+ var get = function (url)+ {+ return A4(Request,"GET",url,"",_J.toList([]))+ };+ var sendGet = function (reqs)+ {+ return send(A2(Signal.lift,get,reqs))+ };+ var post = F2(function (url,body)+ {+ return A4(Request,"POST",url,body,_J.toList([]))+ });+ var request = Request;+ var Failure = F2(function (a,b)+ {+ return {ctor: "Failure", _0: a, _1: b}+ });+ elm.Http.values = {_op: _op, request: request, get: get, post: post, send: send, sendGet: sendGet, Success: Success, Waiting: Waiting, Failure: Failure, Request: Request};+ return elm.Http.values+ };Elm.JavaScript = Elm.JavaScript || {};+Elm.JavaScript.make = function (elm)+ {+ elm.JavaScript = elm.JavaScript || {};+ if (elm.JavaScript.values)+ return elm.JavaScript.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "JavaScript";+ var Native = Native || {};+ Native.JavaScript = Elm.Native.JavaScript.make(elm);+ var _op = {};+ var toString = Native.JavaScript.toString;+ var toList = Native.JavaScript.toList;+ var toInt = Native.JavaScript.toInt;+ var toFloat = Native.JavaScript.toFloat;+ var toBool = Native.JavaScript.toBool;+ var fromString = Native.JavaScript.fromString;+ var fromList = Native.JavaScript.fromList;+ var fromInt = Native.JavaScript.fromInt;+ var fromFloat = Native.JavaScript.fromFloat;+ var fromBool = Native.JavaScript.fromBool;+ var JSString = {ctor: "JSString"};+ var JSObject = {ctor: "JSObject"};+ var JSNumber = {ctor: "JSNumber"};+ var JSDomNode = {ctor: "JSDomNode"};+ var JSBool = {ctor: "JSBool"};+ var JSArray = function (a)+ {+ return {ctor: "JSArray", _0: a}+ };+ elm.JavaScript.values = {_op: _op, toList: toList, toInt: toInt, toFloat: toFloat, toBool: toBool, toString: toString, fromList: fromList, fromInt: fromInt, fromFloat: fromFloat, fromBool: fromBool, fromString: fromString, JSNumber: JSNumber, JSBool: JSBool, JSString: JSString, JSArray: JSArray, JSDomNode: JSDomNode, JSObject: JSObject};+ return elm.JavaScript.values+ };Elm.Json = Elm.Json || {};+Elm.Json.make = function (elm)+ {+ elm.Json = elm.Json || {};+ if (elm.Json.values)+ return elm.Json.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Json";+ var Basics = Elm.Basics.make(elm);+ var Dict = Elm.Dict.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var Native = Native || {};+ Native.Json = Elm.Native.Json.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var _op = {};+ var toString = F2(function (sep,v)+ {+ return JavaScript.toString(A2(Native.Json.toJSString,sep,v))+ });+ var toJSString = Native.Json.toJSString;+ var toJSObject = Native.Json.toJSObject;+ var fromString = function (s)+ {+ return Native.Json.fromJSString(JavaScript.fromString(s))+ };+ var fromJSString = Native.Json.fromJSString;+ var fromJSObject = Native.Json.fromJSObject;+ var String = function (a)+ {+ return {ctor: "String", _0: a}+ };+ var Object = function (a)+ {+ return {ctor: "Object", _0: a}+ };+ var Number = function (a)+ {+ return {ctor: "Number", _0: a}+ };+ var Null = {ctor: "Null"};+ var Boolean = function (a)+ {+ return {ctor: "Boolean", _0: a}+ };+ var Array = function (a)+ {+ return {ctor: "Array", _0: a}+ };+ elm.Json.values = {_op: _op, toString: toString, toJSString: toJSString, fromString: fromString, fromJSString: fromJSString, fromJSObject: fromJSObject, toJSObject: toJSObject, String: String, Number: Number, Boolean: Boolean, Null: Null, Array: Array, Object: Object};+ return elm.Json.values+ };Elm.Keyboard = Elm.Keyboard || {};+Elm.Keyboard.make = function (elm)+ {+ elm.Keyboard = elm.Keyboard || {};+ if (elm.Keyboard.values)+ return elm.Keyboard.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Keyboard";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Keyboard = Elm.Native.Keyboard.make(elm);+ var _op = {};+ var lastPressed = Native.Keyboard.lastPressed;+ var keysDown = Native.Keyboard.keysDown;+ var isDown = Native.Keyboard.isDown;+ var shift = isDown(16);+ var space = isDown(32);+ var enter = isDown(13);+ var directions = Native.Keyboard.directions;+ var wasd = A4(directions,87,83,65,68);+ var ctrl = isDown(17);+ var arrows = A4(directions,38,40,37,39);+ elm.Keyboard.values = {_op: _op, directions: directions, arrows: arrows, wasd: wasd, isDown: isDown, shift: shift, ctrl: ctrl, space: space, enter: enter, keysDown: keysDown, lastPressed: lastPressed};+ return elm.Keyboard.values+ };Elm.List = Elm.List || {};+Elm.List.make = function (elm)+ {+ elm.List = elm.List || {};+ if (elm.List.values)+ return elm.List.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "List";+ var Basics = Elm.Basics.make(elm);+ var Native = Native || {};+ Native.List = Elm.Native.List.make(elm);+ var _op = {};+ var zipWith = Native.List.zipWith;+ var zip = Native.List.zip;+ var take = Native.List.take;+ var tail = Native.List.tail;+ var scanl1 = Native.List.scanl1;+ var scanl = Native.List.scanl;+ var reverse = Native.List.reverse;+ var repeat = Native.List.repeat;+ var map = Native.List.map;+ var length = Native.List.length;+ var last = Native.List.last;+ var join = Native.List.join;+ var isEmpty = function (xs)+ {+ return function ()+ {+ switch (xs.ctor)+ {case+ "[]" :+ return true}+ return false+ }()+ };+ var head = Native.List.head;+ var foldr1 = Native.List.foldr1;+ var foldr = Native.List.foldr;+ var foldl1 = Native.List.foldl1;+ var maximum = foldl1(Basics.max);+ var minimum = foldl1(Basics.min);+ var foldl = Native.List.foldl;+ var or = A2(foldl,+ F2(function (x,y)+ {+ return x || y+ }),+ false);+ var product = A2(foldl,+ F2(function (x,y)+ {+ return x * y+ }),+ 1);+ var sum = A2(foldl,+ F2(function (x,y)+ {+ return x + y+ }),+ 0);+ var filter = Native.List.filter;+ var drop = Native.List.drop;+ var concat = Native.List.concat;+ var concatMap = F2(function (f,list)+ {+ return concat(A2(map,f,list))+ });+ var any = Native.List.any;+ var and = A2(foldl,+ F2(function (x,y)+ {+ return x && y+ }),+ true);+ var all = Native.List.all;+ _op["::"] = Native.List.cons;+ var intersperse = F2(function (sep,xs)+ {+ return function ()+ {+ switch (xs.ctor)+ {case+ "::" :+ switch (xs._1.ctor)+ {case+ "::" :+ return {ctor: "::", _0: xs._0, _1: {ctor: "::", _0: sep, _1: A2(intersperse,+ sep,+ {ctor: "::", _0: xs._1._0, _1: xs._1._1})}}+ case+ "[]" :+ return _J.toList([xs._0])}+ break;+ case+ "[]" :+ return _J.toList([])}+ _E.Case($moduleName,"between lines 209 and 214");+ }()+ });+ var partition = F2(function (pred,lst)+ {+ return function ()+ {+ switch (lst.ctor)+ {case+ "::" :+ return function ()+ {+ var $ = A2(partition,pred,lst._1),+ bs = $._0,+ cs = $._1;+ return pred(lst._0) ? {ctor: "_Tuple2", _0: {ctor: "::", _0: lst._0, _1: bs}, _1: cs} : {ctor: "_Tuple2", _0: bs, _1: {ctor: "::", _0: lst._0, _1: cs}}+ }()+ case+ "[]" :+ return {ctor: "_Tuple2", _0: _J.toList([]), _1: _J.toList([])}}+ _E.Case($moduleName,"between lines 166 and 176");+ }()+ });+ var unzip = function (pairs)+ {+ return function ()+ {+ switch (pairs.ctor)+ {case+ "::" :+ switch (pairs._0.ctor)+ {case+ "_Tuple2" :+ return function ()+ {+ var $ = unzip(pairs._1),xs = $._0,ys = $._1;+ return {ctor: "_Tuple2", _0: {ctor: "::", _0: pairs._0._0, _1: xs}, _1: {ctor: "::", _0: pairs._0._1, _1: ys}}+ }()}+ break;+ case+ "[]" :+ return {ctor: "_Tuple2", _0: _J.toList([]), _1: _J.toList([])}}+ _E.Case($moduleName,"between lines 191 and 199");+ }()+ };+ _op["++"] = Native.List.append;+ elm.List.values = {_op: _op, head: head, tail: tail, last: last, isEmpty: isEmpty, map: map, foldl: foldl, foldr: foldr, foldl1: foldl1, foldr1: foldr1, scanl: scanl, scanl1: scanl1, filter: filter, length: length, reverse: reverse, all: all, any: any, and: and, or: or, concat: concat, concatMap: concatMap, sum: sum, product: product, maximum: maximum, minimum: minimum, partition: partition, zip: zip, zipWith: zipWith, unzip: unzip, join: join, intersperse: intersperse, take: take, drop: drop, repeat: repeat};+ return elm.List.values+ };Elm.Maybe = Elm.Maybe || {};+Elm.Maybe.make = function (elm)+ {+ elm.Maybe = elm.Maybe || {};+ if (elm.Maybe.values)+ return elm.Maybe.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Maybe";+ var Basics = Elm.Basics.make(elm);+ var List = Elm.List.make(elm);+ var _op = {};+ var Nothing = {ctor: "Nothing"};+ var Just = function (a)+ {+ return {ctor: "Just", _0: a}+ };+ var maybe = F3(function (b,f,m)+ {+ return function ()+ {+ switch (m.ctor)+ {case+ "Just" :+ return f(m._0)+ case+ "Nothing" :+ return b}+ _E.Case($moduleName,"between lines 28 and 33");+ }()+ });+ var cons = F2(function (mx,xs)+ {+ return A3(maybe,+ xs,+ function (x)+ {+ return {ctor: "::", _0: x, _1: xs}+ },+ mx)+ });+ var justs = A2(List.foldr,cons,_J.toList([]));+ var isJust = A2(maybe,+ false,+ function (arg0)+ {+ return function ()+ {+ return true+ }()+ });+ var isNothing = function ($)+ {+ return Basics.not(isJust($))+ };+ elm.Maybe.values = {_op: _op, maybe: maybe, isJust: isJust, isNothing: isNothing, cons: cons, justs: justs, Just: Just, Nothing: Nothing};+ return elm.Maybe.values+ };Elm.Mouse = Elm.Mouse || {};+Elm.Mouse.make = function (elm)+ {+ elm.Mouse = elm.Mouse || {};+ if (elm.Mouse.values)+ return elm.Mouse.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Mouse";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Mouse = Elm.Native.Mouse.make(elm);+ var _op = {};+ var y = Native.Mouse.y;+ var x = Native.Mouse.x;+ var position = Native.Mouse.position;+ var isDown = Native.Mouse.isDown;+ var isClicked = Native.Mouse.isClicked;+ var clicks = Native.Mouse.clicks;+ elm.Mouse.values = {_op: _op, position: position, x: x, y: y, isDown: isDown, isClicked: isClicked, clicks: clicks};+ return elm.Mouse.values+ };Elm.Prelude = Elm.Prelude || {};+Elm.Prelude.make = function (elm)+ {+ elm.Prelude = elm.Prelude || {};+ if (elm.Prelude.values)+ return elm.Prelude.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Prelude";+ var Basics = Elm.Basics.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var Native = Native || {};+ Native.Prelude = Elm.Native.Prelude.make(elm);+ var Native = Native || {};+ Native.Show = Elm.Native.Show.make(elm);+ var _op = {};+ var show = Native.Show.show;+ var readInt = Native.Prelude.readInt;+ var readFloat = Native.Prelude.readFloat;+ elm.Prelude.values = {_op: _op, show: show, readInt: readInt, readFloat: readFloat};+ return elm.Prelude.values+ };Elm.Random = Elm.Random || {};+Elm.Random.make = function (elm)+ {+ elm.Random = elm.Random || {};+ if (elm.Random.values)+ return elm.Random.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Random";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Random = Elm.Native.Random.make(elm);+ var _op = {};+ var range = Native.Random.range;+ var floatList = Native.Random.floatList;+ var $float = Native.Random.float_;+ elm.Random.values = {_op: _op, range: range, $float: $float, floatList: floatList};+ return elm.Random.values+ };Elm.Set = Elm.Set || {};+Elm.Set.make = function (elm)+ {+ elm.Set = elm.Set || {};+ if (elm.Set.values)+ return elm.Set.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Set";+ var Maybe = Elm.Maybe.make(elm);+ var Dict = Elm.Dict.make(elm);+ var List = Elm.List.make(elm);+ var _op = {};+ var union = Dict.union;+ var toList = Dict.keys;+ var singleton = function (k)+ {+ return A2(Dict.singleton,k,{ctor: "_Tuple0"})+ };+ var remove = Dict.remove;+ var member = Dict.member;+ var intersect = Dict.intersect;+ var insert = function (k)+ {+ return A2(Dict.insert,k,{ctor: "_Tuple0"})+ };+ var foldr = F3(function (f,b,s)+ {+ return A3(Dict.foldr,+ F3(function (k,arg1,b)+ {+ return function ()+ {+ return A2(f,k,b)+ }()+ }),+ b,+ s)+ });+ var foldl = F3(function (f,b,s)+ {+ return A3(Dict.foldl,+ F3(function (k,arg1,b)+ {+ return function ()+ {+ return A2(f,k,b)+ }()+ }),+ b,+ s)+ });+ var empty = Dict.empty;+ var fromList = function (xs)+ {+ return A3(List.foldl,insert,empty,xs)+ };+ var map = F2(function (f,s)+ {+ return fromList(A2(List.map,f,toList(s)))+ });+ var diff = Dict.diff;+ elm.Set.values = {_op: _op, empty: empty, singleton: singleton, insert: insert, remove: remove, member: member, foldl: foldl, foldr: foldr, map: map, union: union, intersect: intersect, diff: diff, toList: toList, fromList: fromList};+ return elm.Set.values+ };Elm.Signal = Elm.Signal || {};+Elm.Signal.make = function (elm)+ {+ elm.Signal = elm.Signal || {};+ if (elm.Signal.values)+ return elm.Signal.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Signal";+ var Native = Native || {};+ Native.Signal = Elm.Native.Signal.make(elm);+ var List = Elm.List.make(elm);+ var _op = {};+ _op["~"] = F2(function (sf,s)+ {+ return A3(Native.Signal.lift2,+ F2(function (f,x)+ {+ return f(x)+ }),+ sf,+ s)+ });+ var sampleOn = Native.Signal.sampleOn;+ var merges = Native.Signal.merges;+ var merge = Native.Signal.merge;+ var lift8 = Native.Signal.lift8;+ var lift7 = Native.Signal.lift7;+ var lift6 = Native.Signal.lift6;+ var lift5 = Native.Signal.lift5;+ var lift4 = Native.Signal.lift4;+ var lift3 = Native.Signal.lift3;+ var lift2 = Native.Signal.lift2;+ var lift = Native.Signal.lift;+ var keepWhen = Native.Signal.keepWhen;+ var keepIf = Native.Signal.keepIf;+ var foldp = Native.Signal.foldp;+ var dropWhen = Native.Signal.dropWhen;+ var dropRepeats = Native.Signal.dropRepeats;+ var dropIf = Native.Signal.dropIf;+ var countIf = Native.Signal.countIf;+ var count = Native.Signal.count;+ var constant = Native.Signal.constant;+ var combine = A2(List.foldr,+ Native.Signal.lift2(F2(function (x,y)+ {+ return {ctor: "::", _0: x, _1: y}+ })),+ Native.Signal.constant(_J.toList([])));+ var Signal = {ctor: "Signal"};+ _op["<~"] = F2(function (f,s)+ {+ return A2(Native.Signal.lift,f,s)+ });+ elm.Signal.values = {_op: _op, constant: constant, lift: lift, lift2: lift2, lift3: lift3, lift4: lift4, lift5: lift5, lift6: lift6, lift7: lift7, lift8: lift8, foldp: foldp, merge: merge, merges: merges, combine: combine, count: count, countIf: countIf, keepIf: keepIf, dropIf: dropIf, keepWhen: keepWhen, dropWhen: dropWhen, dropRepeats: dropRepeats, sampleOn: sampleOn, Signal: Signal};+ return elm.Signal.values+ };Elm.String = Elm.String || {};+Elm.String.make = function (elm)+ {+ elm.String = elm.String || {};+ if (elm.String.values)+ return elm.String.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "String";+ var Native = Native || {};+ Native.String = Elm.Native.String.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var _op = {};+ var words = Native.String.words;+ var uncons = Native.String.uncons;+ var trimRight = Native.String.trimRight;+ var trimLeft = Native.String.trimLeft;+ var trim = Native.String.trim;+ var toUpper = Native.String.toUpper;+ var toLower = Native.String.toLower;+ var toList = Native.String.toList;+ var toInt = Native.String.toInt;+ var toFloat = Native.String.toFloat;+ var sub = Native.String.sub;+ var startsWith = Native.String.startsWith;+ var split = Native.String.split;+ var right = Native.String.right;+ var reverse = Native.String.reverse;+ var repeat = Native.String.repeat;+ var padRight = Native.String.padRight;+ var padLeft = Native.String.padLeft;+ var pad = Native.String.pad;+ var map = Native.String.map;+ var lines = Native.String.lines;+ var length = Native.String.length;+ var left = Native.String.left;+ var join = Native.String.join;+ var isEmpty = Native.String.isEmpty;+ var indices = Native.String.indexes;+ var indexes = Native.String.indexes;+ var fromList = Native.String.fromList;+ var foldr = Native.String.foldr;+ var foldl = Native.String.foldl;+ var filter = Native.String.filter;+ var endsWith = Native.String.endsWith;+ var dropRight = Native.String.dropRight;+ var dropLeft = Native.String.dropLeft;+ var contains = Native.String.contains;+ var cons = Native.String.cons;+ var concat = Native.String.concat;+ var append = Native.String.append;+ var any = Native.String.any;+ var all = Native.String.all;+ elm.String.values = {_op: _op, isEmpty: isEmpty, cons: cons, uncons: uncons, append: append, concat: concat, length: length, map: map, filter: filter, reverse: reverse, foldl: foldl, foldr: foldr, split: split, join: join, repeat: repeat, sub: sub, left: left, right: right, dropLeft: dropLeft, dropRight: dropRight, pad: pad, padLeft: padLeft, padRight: padRight, trim: trim, trimLeft: trimLeft, trimRight: trimRight, words: words, lines: lines, toUpper: toUpper, toLower: toLower, any: any, all: all, contains: contains, startsWith: startsWith, endsWith: endsWith, indexes: indexes, indices: indices, toInt: toInt, toFloat: toFloat, toList: toList, fromList: fromList};+ return elm.String.values+ };Elm.Text = Elm.Text || {};+Elm.Text.make = function (elm)+ {+ elm.Text = elm.Text || {};+ if (elm.Text.values)+ return elm.Text.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Text";+ var Basics = Elm.Basics.make(elm);+ var Color = Elm.Color.make(elm);+ var Graphics = Graphics || {};+ Graphics.Element = Elm.Graphics.Element.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var Native = Native || {};+ Native.Text = Elm.Native.Text.make(elm);+ var _op = {};+ var underline = Native.Text.underline;+ var typeface = Native.Text.typeface;+ var toText = Native.Text.toText;+ var text = Native.Text.text;+ var strikeThrough = Native.Text.strikeThrough;+ var righted = Native.Text.righted;+ var plainText = Native.Text.plainText;+ var overline = Native.Text.overline;+ var monospace = Native.Text.monospace;+ var markdown = Native.Text.markdown;+ var link = Native.Text.link;+ var justified = Native.Text.justified;+ var italic = Native.Text.italic;+ var height = Native.Text.height;+ var header = Native.Text.header;+ var color = Native.Text.color;+ var centered = Native.Text.centered;+ var bold = Native.Text.bold;+ var asText = Native.Text.asText;+ var Text = {ctor: "Text"};+ elm.Text.values = {_op: _op, toText: toText, typeface: typeface, monospace: monospace, header: header, link: link, height: height, color: color, bold: bold, italic: italic, overline: overline, underline: underline, strikeThrough: strikeThrough, justified: justified, centered: centered, righted: righted, text: text, plainText: plainText, markdown: markdown, asText: asText, Text: Text};+ return elm.Text.values+ };Elm.Time = Elm.Time || {};+Elm.Time.make = function (elm)+ {+ elm.Time = elm.Time || {};+ if (elm.Time.values)+ return elm.Time.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Time";+ var Basics = Elm.Basics.make(elm);+ var Native = Native || {};+ Native.Time = Elm.Native.Time.make(elm);+ var Signal = Elm.Signal.make(elm);+ var _op = {};+ var timestamp = Native.Time.timestamp;+ var since = Native.Time.since;+ var millisecond = 1;+ var second = 1000 * millisecond;+ var minute = 60 * second;+ var inSeconds = function (t)+ {+ return t / second+ };+ var inMinutes = function (t)+ {+ return t / minute+ };+ var inMilliseconds = function (t)+ {+ return t+ };+ var hour = 60 * minute;+ var inHours = function (t)+ {+ return t / hour+ };+ var fpsWhen = Native.Time.fpsWhen;+ var fps = Native.Time.fps;+ var every = Native.Time.every;+ var delay = Native.Time.delay;+ elm.Time.values = {_op: _op, millisecond: millisecond, second: second, minute: minute, hour: hour, inMilliseconds: inMilliseconds, inSeconds: inSeconds, inMinutes: inMinutes, inHours: inHours, fps: fps, fpsWhen: fpsWhen, every: every, since: since, timestamp: timestamp, delay: delay};+ return elm.Time.values+ };Elm.Touch = Elm.Touch || {};+Elm.Touch.make = function (elm)+ {+ elm.Touch = elm.Touch || {};+ if (elm.Touch.values)+ return elm.Touch.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Touch";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Touch = Elm.Native.Touch.make(elm);+ var Time = Elm.Time.make(elm);+ var _op = {};+ var touches = Native.Touch.touches;+ var taps = Native.Touch.taps;+ var Touch = F6(function (a,b,c,d,e,f)+ {+ return {_: {}, id: c, t0: f, x: a, x0: d, y: b, y0: e}+ });+ elm.Touch.values = {_op: _op, touches: touches, taps: taps, Touch: Touch};+ return elm.Touch.values+ };Elm.Transform2D = Elm.Transform2D || {};+Elm.Transform2D.make = function (elm)+ {+ elm.Transform2D = elm.Transform2D || {};+ if (elm.Transform2D.values)+ return elm.Transform2D.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Transform2D";+ var Native = Native || {};+ Native.Transform2D = Elm.Native.Transform2D.make(elm);+ var _op = {};+ var rotation = Native.Transform2D.rotation;+ var multiply = Native.Transform2D.multiply;+ var matrix = Native.Transform2D.matrix;+ var identity = Native.Transform2D.identity;+ var Transform2D = {ctor: "Transform2D"};+ elm.Transform2D.values = {_op: _op, identity: identity, matrix: matrix, rotation: rotation, multiply: multiply, Transform2D: Transform2D};+ return elm.Transform2D.values+ };Elm.WebSocket = Elm.WebSocket || {};+Elm.WebSocket.make = function (elm)+ {+ elm.WebSocket = elm.WebSocket || {};+ if (elm.WebSocket.values)+ return elm.WebSocket.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "WebSocket";+ var Signal = Elm.Signal.make(elm);+ var Basics = Elm.Basics.make(elm);+ var Native = Native || {};+ Native.WebSocket = Elm.Native.WebSocket.make(elm);+ var _op = {};+ var connect = Native.WebSocket.connect;+ elm.WebSocket.values = {_op: _op, connect: connect};+ return elm.WebSocket.values+ };Elm.Window = Elm.Window || {};+Elm.Window.make = function (elm)+ {+ elm.Window = elm.Window || {};+ if (elm.Window.values)+ return elm.Window.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Window";+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Window = Elm.Native.Window.make(elm);+ var _op = {};+ var width = Native.Window.width;+ var height = Native.Window.height;+ var dimensions = Native.Window.dimensions;+ elm.Window.values = {_op: _op, dimensions: dimensions, width: width, height: height};+ return elm.Window.values+ };Elm.Graphics = Elm.Graphics || {};+Elm.Graphics.Collage = Elm.Graphics.Collage || {};+Elm.Graphics.Collage.make = function (elm)+ {+ elm.Graphics = elm.Graphics || {};+ elm.Graphics.Collage = elm.Graphics.Collage || {};+ if (elm.Graphics.Collage.values)+ return elm.Graphics.Collage.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Graphics.Collage";+ var Basics = Elm.Basics.make(elm);+ var List = Elm.List.make(elm);+ var Either = Elm.Either.make(elm);+ var Transform2D = Elm.Transform2D.make(elm);+ var Native = Native || {};+ Native.Graphics = Native.Graphics || {};+ Native.Graphics.Collage = Elm.Native.Graphics.Collage.make(elm);+ var Graphics = Graphics || {};+ Graphics.Element = Elm.Graphics.Element.make(elm);+ var Color = Elm.Color.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var _op = {};+ var segment = F2(function (p1,p2)+ {+ return _J.toList([p1,p2])+ });+ var scale = F2(function (s,f)+ {+ return _N.replace([["scale",f.scale * s]],f)+ });+ var rotate = F2(function (t,f)+ {+ return _N.replace([["theta",f.theta + t]],f)+ });+ var rect = F2(function (w,h)+ {+ return function ()+ {+ var hw = w / 2;+ var hh = h / 2;+ return _J.toList([{ctor: "_Tuple2", _0: 0 - hw, _1: 0 - hh},+ {ctor: "_Tuple2", _0: 0 - hw, _1: hh},+ {ctor: "_Tuple2", _0: hw, _1: hh},+ {ctor: "_Tuple2", _0: hw, _1: 0 - hh}])+ }()+ });+ var square = function (n)+ {+ return A2(rect,n,n)+ };+ var polygon = function (points)+ {+ return points+ };+ var path = function (ps)+ {+ return ps+ };+ var oval = F2(function (w,h)+ {+ return function ()+ {+ var n = 50;+ var t = 2 * Basics.pi / n;+ var hw = w / 2;+ var hh = h / 2;+ var f = function (i)+ {+ return {ctor: "_Tuple2", _0: hw * Basics.cos(t * i), _1: hh * Basics.sin(t * i)}+ };+ return A2(List.map,f,_L.range(0,n - 1))+ }()+ });+ var ngon = F2(function (n,r)+ {+ return function ()+ {+ var m = Basics.toFloat(n);+ var t = 2 * Basics.pi / m;+ var f = function (i)+ {+ return {ctor: "_Tuple2", _0: r * Basics.cos(t * i), _1: r * Basics.sin(t * i)}+ };+ return A2(List.map,f,_L.range(0,m - 1))+ }()+ });+ var moveY = F2(function (y,f)+ {+ return _N.replace([["y",f.y + y]],f)+ });+ var moveX = F2(function (x,f)+ {+ return _N.replace([["x",f.x + x]],f)+ });+ var move = F2(function (arg1,f)+ {+ return function ()+ {+ switch (arg1.ctor)+ {case+ "_Tuple2" :+ return _N.replace([["x",f.x + arg1._0],+ ["y",f.y + arg1._1]],+ f)}+ _E.Case($moduleName,+ "on line 182, column 20 to 48");+ }()+ });+ var form = function (f)+ {+ return {_: {}, alpha: 1, form: f, scale: 1, theta: 0, x: 0, y: 0}+ };+ var collage = Native.Graphics.Collage.collage;+ var circle = function (r)+ {+ return A2(oval,2 * r,2 * r)+ };+ var alpha = F2(function (a,f)+ {+ return _N.replace([["alpha",a]],f)+ });+ var Texture = function (a)+ {+ return {ctor: "Texture", _0: a}+ };+ var Solid = function (a)+ {+ return {ctor: "Solid", _0: a}+ };+ var Smooth = {ctor: "Smooth"};+ var Sharp = function (a)+ {+ return {ctor: "Sharp", _0: a}+ };+ var Round = {ctor: "Round"};+ var Padded = {ctor: "Padded"};+ var LineStyle = F6(function (a,b,c,d,e,f)+ {+ return {_: {}, cap: c, color: a, dashOffset: f, dashing: e, join: d, width: b}+ });+ var Grad = function (a)+ {+ return {ctor: "Grad", _0: a}+ };+ var Form = F6(function (a,b,c,d,e,f)+ {+ return {_: {}, alpha: e, form: f, scale: b, theta: a, x: c, y: d}+ });+ var Flat = {ctor: "Flat"};+ var defaultLine = {_: {}, cap: Flat, color: Color.black, dashOffset: 0, dashing: _J.toList([]), join: Sharp(10), width: 1};+ var dashed = function (clr)+ {+ return _N.replace([["color",clr],+ ["dashing",_J.toList([8,4])]],+ defaultLine)+ };+ var dotted = function (clr)+ {+ return _N.replace([["color",clr],+ ["dashing",_J.toList([3,3])]],+ defaultLine)+ };+ var solid = function (clr)+ {+ return _N.replace([["color",clr]],defaultLine)+ };+ var FShape = F2(function (a,b)+ {+ return {ctor: "FShape", _0: a, _1: b}+ });+ var fill = F2(function (style,shape)+ {+ return form(A2(FShape,Either.Right(style),shape))+ });+ var filled = F2(function (color,shape)+ {+ return A2(fill,Solid(color),shape)+ });+ var gradient = F2(function (grad,shape)+ {+ return A2(fill,Grad(grad),shape)+ });+ var textured = F2(function (src,shape)+ {+ return A2(fill,Texture(src),shape)+ });+ var outlined = F2(function (style,shape)+ {+ return form(A2(FShape,Either.Left(style),shape))+ });+ var FPath = F2(function (a,b)+ {+ return {ctor: "FPath", _0: a, _1: b}+ });+ var traced = F2(function (style,path)+ {+ return form(A2(FPath,style,path))+ });+ var FImage = F4(function (a,b,c,d)+ {+ return {ctor: "FImage", _0: a, _1: b, _2: c, _3: d}+ });+ var sprite = F4(function (w,h,pos,src)+ {+ return form(A4(FImage,w,h,pos,src))+ });+ var FGroup = F2(function (a,b)+ {+ return {ctor: "FGroup", _0: a, _1: b}+ });+ var group = function (fs)+ {+ return form(A2(FGroup,Transform2D.identity,fs))+ };+ var groupTransform = F2(function (matrix,fs)+ {+ return form(A2(FGroup,matrix,fs))+ });+ var FElement = function (a)+ {+ return {ctor: "FElement", _0: a}+ };+ var toForm = function (e)+ {+ return form(FElement(e))+ };+ var Clipped = {ctor: "Clipped"};+ elm.Graphics.Collage.values = {_op: _op, defaultLine: defaultLine, solid: solid, dashed: dashed, dotted: dotted, form: form, fill: fill, filled: filled, textured: textured, gradient: gradient, outlined: outlined, traced: traced, sprite: sprite, toForm: toForm, group: group, groupTransform: groupTransform, rotate: rotate, scale: scale, move: move, moveX: moveX, moveY: moveY, alpha: alpha, collage: collage, path: path, segment: segment, polygon: polygon, rect: rect, square: square, oval: oval, circle: circle, ngon: ngon, Solid: Solid, Texture: Texture, Grad: Grad, Flat: Flat, Round: Round, Padded: Padded, Smooth: Smooth, Sharp: Sharp, Clipped: Clipped, FPath: FPath, FShape: FShape, FImage: FImage, FElement: FElement, FGroup: FGroup, Form: Form, LineStyle: LineStyle};+ return elm.Graphics.Collage.values+ };Elm.Graphics = Elm.Graphics || {};+Elm.Graphics.Element = Elm.Graphics.Element || {};+Elm.Graphics.Element.make = function (elm)+ {+ elm.Graphics = elm.Graphics || {};+ elm.Graphics.Element = elm.Graphics.Element || {};+ if (elm.Graphics.Element.values)+ return elm.Graphics.Element.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Graphics.Element";+ var Basics = Elm.Basics.make(elm);+ var Native = Native || {};+ Native.Utils = Elm.Native.Utils.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var List = Elm.List.make(elm);+ var Color = Elm.Color.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var _op = {};+ var widthOf = function (e)+ {+ return e.props.width+ };+ var tag = F2(function (name,e)+ {+ return function ()+ {+ var p = e.props;+ return {_: {}, element: e.element, props: _N.replace([["tag",+ JavaScript.fromString(name)]],+ p)}+ }()+ });+ var sizeOf = function (e)+ {+ return {ctor: "_Tuple2", _0: e.props.width, _1: e.props.height}+ };+ var opacity = F2(function (o,e)+ {+ return function ()+ {+ var p = e.props;+ return {_: {}, element: e.element, props: _N.replace([["opacity",+ o]],+ p)}+ }()+ });+ var link = F2(function (href,e)+ {+ return function ()+ {+ var p = e.props;+ return {_: {}, element: e.element, props: _N.replace([["href",+ JavaScript.fromString(href)]],+ p)}+ }()+ });+ var heightOf = function (e)+ {+ return e.props.height+ };+ var emptyStr = JavaScript.fromString("");+ var color = F2(function (c,e)+ {+ return function ()+ {+ var p = e.props;+ return {_: {}, element: e.element, props: _N.replace([["color",+ Maybe.Just(c)]],+ p)}+ }()+ });+ var Z = {ctor: "Z"};+ var middleAt = F2(function (x,y)+ {+ return {_: {}, horizontal: Z, vertical: Z, x: x, y: y}+ });+ var Tiled = {ctor: "Tiled"};+ var Spacer = {ctor: "Spacer"};+ var Relative = function (a)+ {+ return {ctor: "Relative", _0: a}+ };+ var middle = {_: {}, horizontal: Z, vertical: Z, x: Relative(0.5), y: Relative(0.5)};+ var relative = Relative;+ var RawHtml = function (a)+ {+ return {ctor: "RawHtml", _0: a}+ };+ var Properties = F8(function (a,b,c,d,e,f,g,h)+ {+ return {_: {}, color: e, height: c, hover: h, href: f, id: a, opacity: d, tag: g, width: b}+ });+ var newElement = F3(function (w,h,e)+ {+ return {_: {}, element: e, props: A8(Properties,+ Native.Utils.guid({ctor: "_Tuple0"}),+ w,+ h,+ 1,+ Maybe.Nothing,+ emptyStr,+ emptyStr,+ {ctor: "_Tuple0"})}+ });+ var spacer = F2(function (w,h)+ {+ return A3(newElement,w,h,Spacer)+ });+ var Position = F4(function (a,b,c,d)+ {+ return {_: {}, horizontal: a, vertical: b, x: c, y: d}+ });+ var Plain = {ctor: "Plain"};+ var P = {ctor: "P"};+ var midRightAt = F2(function (x,y)+ {+ return {_: {}, horizontal: P, vertical: Z, x: x, y: y}+ });+ var midTopAt = F2(function (x,y)+ {+ return {_: {}, horizontal: Z, vertical: P, x: x, y: y}+ });+ var topRightAt = F2(function (x,y)+ {+ return {_: {}, horizontal: P, vertical: P, x: x, y: y}+ });+ var N = {ctor: "N"};+ var bottomLeftAt = F2(function (x,y)+ {+ return {_: {}, horizontal: N, vertical: N, x: x, y: y}+ });+ var bottomRightAt = F2(function (x,y)+ {+ return {_: {}, horizontal: P, vertical: N, x: x, y: y}+ });+ var midBottomAt = F2(function (x,y)+ {+ return {_: {}, horizontal: Z, vertical: N, x: x, y: y}+ });+ var midLeftAt = F2(function (x,y)+ {+ return {_: {}, horizontal: N, vertical: Z, x: x, y: y}+ });+ var topLeftAt = F2(function (x,y)+ {+ return {_: {}, horizontal: N, vertical: P, x: x, y: y}+ });+ var Image = F4(function (a,b,c,d)+ {+ return {ctor: "Image", _0: a, _1: b, _2: c, _3: d}+ });+ var height = F2(function (nh,e)+ {+ return function ()+ {+ var p = e.props;+ var props = function ()+ {+ var _case0 = e.element;+ switch (_case0.ctor)+ {case+ "Image" :+ return _N.replace([["width",+ Basics.round(Basics.toFloat(_case0._1) / Basics.toFloat(_case0._2) * Basics.toFloat(nh))]],+ p)}+ return p+ }();+ return {_: {}, element: e.element, props: _N.replace([["height",+ nh]],+ p)}+ }()+ });+ var image = F3(function (w,h,src)+ {+ return A3(newElement,+ w,+ h,+ A4(Image,+ Plain,+ w,+ h,+ JavaScript.fromString(src)))+ });+ var tiledImage = F3(function (w,h,src)+ {+ return A3(newElement,+ w,+ h,+ A4(Image,+ Tiled,+ w,+ h,+ JavaScript.fromString(src)))+ });+ var width = F2(function (nw,e)+ {+ return function ()+ {+ var p = e.props;+ var props = function ()+ {+ var _case5 = e.element;+ switch (_case5.ctor)+ {case+ "Image" :+ return _N.replace([["height",+ Basics.round(Basics.toFloat(_case5._2) / Basics.toFloat(_case5._1) * Basics.toFloat(nw))]],+ p)+ case+ "RawHtml" :+ return _N.replace([["height",+ Basics.snd(A2(Native.Utils.htmlHeight,+ nw,+ _case5._0))]],+ p)}+ return p+ }();+ return {_: {}, element: e.element, props: _N.replace([["width",+ nw]],+ props)}+ }()+ });+ var size = F3(function (w,h,e)+ {+ return A2(height,h,A2(width,w,e))+ });+ var Flow = F2(function (a,b)+ {+ return {ctor: "Flow", _0: a, _1: b}+ });+ var Fitted = {ctor: "Fitted"};+ var fittedImage = F3(function (w,h,src)+ {+ return A3(newElement,+ w,+ h,+ A4(Image,+ Fitted,+ w,+ h,+ JavaScript.fromString(src)))+ });+ var Element = F2(function (a,b)+ {+ return {_: {}, element: b, props: a}+ });+ var DUp = {ctor: "DUp"};+ var up = DUp;+ var DRight = {ctor: "DRight"};+ var right = DRight;+ var beside = F2(function (lft,rht)+ {+ return A3(newElement,+ widthOf(lft) + widthOf(rht),+ A2(Basics.max,+ heightOf(lft),+ heightOf(rht)),+ A2(Flow,right,_J.toList([lft,rht])))+ });+ var DOut = {ctor: "DOut"};+ var layers = function (es)+ {+ return function ()+ {+ var ws = A2(List.map,widthOf,es);+ var hs = A2(List.map,heightOf,es);+ return A3(newElement,+ List.maximum(ws),+ List.maximum(hs),+ A2(Flow,DOut,es))+ }()+ };+ var outward = DOut;+ var DLeft = {ctor: "DLeft"};+ var left = DLeft;+ var DIn = {ctor: "DIn"};+ var inward = DIn;+ var DDown = {ctor: "DDown"};+ var above = F2(function (hi,lo)+ {+ return A3(newElement,+ A2(Basics.max,widthOf(hi),widthOf(lo)),+ heightOf(hi) + heightOf(lo),+ A2(Flow,DDown,_J.toList([hi,lo])))+ });+ var below = F2(function (lo,hi)+ {+ return A3(newElement,+ A2(Basics.max,widthOf(hi),widthOf(lo)),+ heightOf(hi) + heightOf(lo),+ A2(Flow,DDown,_J.toList([hi,lo])))+ });+ var down = DDown;+ var flow = F2(function (dir,es)+ {+ return function ()+ {+ var ws = A2(List.map,widthOf,es);+ var newFlow = F2(function (w,h)+ {+ return A3(newElement,+ w,+ h,+ A2(Flow,dir,es))+ });+ var hs = A2(List.map,heightOf,es);+ return _N.eq(es,_J.toList([])) ? A2(spacer,+ 0,+ 0) : function ()+ {+ switch (dir.ctor)+ {case+ "DDown" :+ return A2(newFlow,+ List.maximum(ws),+ List.sum(hs))+ case+ "DIn" :+ return A2(newFlow,+ List.maximum(ws),+ List.maximum(hs))+ case+ "DLeft" :+ return A2(newFlow,+ List.sum(ws),+ List.maximum(hs))+ case+ "DOut" :+ return A2(newFlow,+ List.maximum(ws),+ List.maximum(hs))+ case+ "DRight" :+ return A2(newFlow,+ List.sum(ws),+ List.maximum(hs))+ case+ "DUp" :+ return A2(newFlow,+ List.maximum(ws),+ List.sum(hs))}+ _E.Case($moduleName,+ "between lines 199 and 209");+ }()+ }()+ });+ var Custom = {ctor: "Custom"};+ var Cropped = function (a)+ {+ return {ctor: "Cropped", _0: a}+ };+ var croppedImage = F4(function (pos,w,h,src)+ {+ return A3(newElement,+ w,+ h,+ A4(Image,+ Cropped(pos),+ w,+ h,+ JavaScript.fromString(src)))+ });+ var Container = F2(function (a,b)+ {+ return {ctor: "Container", _0: a, _1: b}+ });+ var container = F4(function (w,h,pos,e)+ {+ return A3(newElement,w,h,A2(Container,pos,e))+ });+ var Absolute = function (a)+ {+ return {ctor: "Absolute", _0: a}+ };+ var absolute = Absolute;+ var midLeft = _N.replace([["horizontal",N],["x",Absolute(0)]],+ middle);+ var midRight = _N.replace([["horizontal",P]],midLeft);+ var midTop = _N.replace([["vertical",P],["y",Absolute(0)]],middle);+ var midBottom = _N.replace([["vertical",N]],midTop);+ var topLeft = {_: {}, horizontal: N, vertical: P, x: Absolute(0), y: Absolute(0)};+ var bottomLeft = _N.replace([["vertical",N]],topLeft);+ var bottomRight = _N.replace([["horizontal",P]],bottomLeft);+ var topRight = _N.replace([["horizontal",P]],topLeft);+ elm.Graphics.Element.values = {_op: _op, widthOf: widthOf, heightOf: heightOf, sizeOf: sizeOf, width: width, height: height, size: size, opacity: opacity, color: color, tag: tag, link: link, emptyStr: emptyStr, newElement: newElement, image: image, fittedImage: fittedImage, croppedImage: croppedImage, tiledImage: tiledImage, container: container, spacer: spacer, flow: flow, above: above, below: below, beside: beside, layers: layers, absolute: absolute, relative: relative, middle: middle, topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight, midLeft: midLeft, midRight: midRight, midTop: midTop, midBottom: midBottom, middleAt: middleAt, topLeftAt: topLeftAt, topRightAt: topRightAt, bottomLeftAt: bottomLeftAt, bottomRightAt: bottomRightAt, midLeftAt: midLeftAt, midRightAt: midRightAt, midTopAt: midTopAt, midBottomAt: midBottomAt, up: up, down: down, left: left, right: right, inward: inward, outward: outward, Image: Image, Container: Container, Flow: Flow, Spacer: Spacer, RawHtml: RawHtml, Custom: Custom, Plain: Plain, Fitted: Fitted, Cropped: Cropped, Tiled: Tiled, P: P, Z: Z, N: N, Absolute: Absolute, Relative: Relative, DUp: DUp, DDown: DDown, DLeft: DLeft, DRight: DRight, DIn: DIn, DOut: DOut, Properties: Properties, Element: Element, Position: Position};+ return elm.Graphics.Element.values+ };Elm.Graphics = Elm.Graphics || {};+Elm.Graphics.Input = Elm.Graphics.Input || {};+Elm.Graphics.Input.make = function (elm)+ {+ elm.Graphics = elm.Graphics || {};+ elm.Graphics.Input = elm.Graphics.Input || {};+ if (elm.Graphics.Input.values)+ return elm.Graphics.Input.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "Graphics.Input";+ var Basics = Elm.Basics.make(elm);+ var Signal = Elm.Signal.make(elm);+ var Native = Native || {};+ Native.Graphics = Native.Graphics || {};+ Native.Graphics.Input = Elm.Native.Graphics.Input.make(elm);+ var List = Elm.List.make(elm);+ var Graphics = Graphics || {};+ Graphics.Element = Elm.Graphics.Element.make(elm);+ var Maybe = Elm.Maybe.make(elm);+ var JavaScript = Elm.JavaScript.make(elm);+ var _op = {};+ var id = function (x)+ {+ return x+ };+ var hoverables = Native.Graphics.Input.hoverables;+ var hoverable = function (elem)+ {+ return function ()+ {+ var pool = hoverables(false);+ return {ctor: "_Tuple2", _0: A2(pool.hoverable,+ id,+ elem), _1: pool.events}+ }()+ };+ var fields = Native.Graphics.Input.fields;+ var emptyFieldState = {_: {}, selectionEnd: 0, selectionStart: 0, string: ""};+ var field = function (placeHolder)+ {+ return function ()+ {+ var tfs = fields(emptyFieldState);+ var changes = Signal.dropRepeats(tfs.events);+ return {ctor: "_Tuple2", _0: A2(Signal.lift,+ A2(tfs.field,+ id,+ placeHolder),+ changes), _1: Signal.dropRepeats(A2(Signal.lift,+ function (_)+ {+ return _.string+ },+ changes))}+ }()+ };+ var password = function (placeHolder)+ {+ return function ()+ {+ var tfs = Native.Graphics.Input.passwords(emptyFieldState);+ var changes = Signal.dropRepeats(tfs.events);+ return {ctor: "_Tuple2", _0: A2(Signal.lift,+ A2(tfs.field,+ id,+ placeHolder),+ changes), _1: Signal.dropRepeats(A2(Signal.lift,+ function (_)+ {+ return _.string+ },+ changes))}+ }()+ };+ var email = function (placeHolder)+ {+ return function ()+ {+ var tfs = Native.Graphics.Input.emails(emptyFieldState);+ var changes = Signal.dropRepeats(tfs.events);+ return {ctor: "_Tuple2", _0: A2(Signal.lift,+ A2(tfs.field,+ id,+ placeHolder),+ changes), _1: Signal.dropRepeats(A2(Signal.lift,+ function (_)+ {+ return _.string+ },+ changes))}+ }()+ };+ var dropDown = Native.Graphics.Input.dropDown;+ var stringDropDown = function (strs)+ {+ return dropDown(A2(List.map,+ function (s)+ {+ return {ctor: "_Tuple2", _0: s, _1: s}+ },+ strs))+ };+ var customButtons = Native.Graphics.Input.customButtons;+ var customButton = F3(function (up,hover,down)+ {+ return function ()+ {+ var pool = customButtons({ctor: "_Tuple0"});+ return {ctor: "_Tuple2", _0: A4(pool.customButton,+ {ctor: "_Tuple0"},+ up,+ hover,+ down), _1: pool.events}+ }()+ });+ var checkboxes = Native.Graphics.Input.checkboxes;+ var checkbox = function (b)+ {+ return function ()+ {+ var cbs = checkboxes(b);+ return {ctor: "_Tuple2", _0: A2(Signal.lift,+ cbs.checkbox(id),+ cbs.events), _1: cbs.events}+ }()+ };+ var buttons = Native.Graphics.Input.buttons;+ var button = function (txt)+ {+ return function ()+ {+ var pool = buttons({ctor: "_Tuple0"});+ return {ctor: "_Tuple2", _0: A2(pool.button,+ {ctor: "_Tuple0"},+ txt), _1: pool.events}+ }()+ };+ var FieldState = F3(function (a,b,c)+ {+ return {_: {}, selectionEnd: c, selectionStart: b, string: a}+ });+ elm.Graphics.Input.values = {_op: _op, id: id, buttons: buttons, button: button, customButtons: customButtons, customButton: customButton, checkboxes: checkboxes, checkbox: checkbox, hoverables: hoverables, hoverable: hoverable, fields: fields, emptyFieldState: emptyFieldState, field: field, password: password, email: email, dropDown: dropDown, stringDropDown: stringDropDown, FieldState: FieldState};+ return elm.Graphics.Input.values+ };Elm.JavaScript = Elm.JavaScript || {};+Elm.JavaScript.Experimental = Elm.JavaScript.Experimental || {};+Elm.JavaScript.Experimental.make = function (elm)+ {+ elm.JavaScript = elm.JavaScript || {};+ elm.JavaScript.Experimental = elm.JavaScript.Experimental || {};+ if (elm.JavaScript.Experimental.values)+ return elm.JavaScript.Experimental.values+ var N = Elm.Native,+ _N = N.Utils.make(elm),+ _L = N.List.make(elm),+ _E = N.Error.make(elm),+ _J = N.JavaScript.make(elm),+ $moduleName = "JavaScript.Experimental";+ var JavaScript = Elm.JavaScript.make(elm);+ var Native = Native || {};+ Native.JavaScript = Elm.Native.JavaScript.make(elm);+ var _op = {};+ var toRecord = Native.JavaScript.toRecord;+ var fromRecord = Native.JavaScript.fromRecord;+ elm.JavaScript.Experimental.values = {_op: _op, toRecord: toRecord, fromRecord: fromRecord};+ return elm.JavaScript.Experimental.values+ };(function() {++// Returns boolean indicating if the swap was successful.+// Requires that the two signal graphs have exactly the same+// structure.+ElmRuntime.swap = function(from, to) {+ function similar(nodeOld,nodeNew) {+ idOkay = nodeOld.id === nodeNew.id;+ lengthOkay = nodeOld.kids.length === nodeNew.kids.length;+ return idOkay && lengthOkay;+ }+ function swap(nodeOld,nodeNew) {+ nodeNew.value = nodeOld.value;+ return true;+ }+ var canSwap = depthFirstTraversals(similar, from.inputs, to.inputs);+ if (canSwap) { depthFirstTraversals(swap, from.inputs, to.inputs); }+ from.node.parentNode.replaceChild(to.node, from.node);+ return canSwap;+}++// Returns false if the node operation f ever fails.+function depthFirstTraversals(f, queueOld, queueNew) {+ if (queueOld.length !== queueNew.length) return false;+ queueOld = queueOld.slice(0);+ queueNew = queueNew.slice(0);++ var seen = [];+ while (queueOld.length > 0 && queueNew.length > 0) {+ var nodeOld = queueOld.pop();+ var nodeNew = queueNew.pop();+ if (seen.indexOf(nodeOld.id) < 0) {+ if (!f(nodeOld, nodeNew)) return false;+ queueOld = queueOld.concat(nodeOld.kids);+ queueNew = queueNew.concat(nodeNew.kids);+ seen.push(nodeOld.id);+ }+ }+ return true;+}++}());++(function() {+'use strict';++Elm.fullscreen = function(module) {+ var style = document.createElement('style');+ style.type = 'text/css';+ style.innerHTML = "html,head,body { padding:0; margin:0; }" ++ "body { font-family: calibri, helvetica, arial, sans-serif; }";+ document.head.appendChild(style);+ var container = document.createElement('div');+ document.body.appendChild(container);+ return init(ElmRuntime.Display.FULLSCREEN, container, module);+};++Elm.embed = function(module, container) {+ var tag = container.tagName;+ if (tag !== 'DIV') {+ throw new Error('Elm.node must be given a DIV, not a ' + tag + '.');+ } else if (container.hasChildNodes()) {+ throw new Error('Elm.node must be given an empty DIV. No children allowed!');+ }+ return init(ElmRuntime.Display.COMPONENT, container, module);+};++Elm.worker = function(module) {+ return init(ElmRuntime.Display.NONE, {}, module);+};++function init(display, container, module, moduleToReplace) {+ // defining state needed for an instance of the Elm RTS+ var inputs = [];++ function notify(id, v) {+ var timestep = Date.now();+ var changed = false;+ for (var i = inputs.length; i--; ) {+ // order is important here to avoid short-circuiting+ changed = inputs[i].recv(timestep, id, v) || changed;+ }+ return changed;+ }++ var listeners = [];+ function addListener(relevantInputs, domNode, eventName, func) {+ domNode.addEventListener(eventName, func);+ var listener = {+ relevantInputs: relevantInputs,+ domNode: domNode,+ eventName: eventName,+ func: func+ };+ listeners.push(listener);+ }++ // create the actual RTS. Any impure modules will attach themselves to this+ // object. This permits many Elm programs to be embedded per document.+ var elm = {+ notify:notify,+ node:container,+ display:display,+ id:ElmRuntime.guid(),+ addListener:addListener,+ inputs:inputs+ };++ // Set up methods to communicate with Elm program from JS.+ function send(name, value) {+ if (typeof value === 'undefined') return function(v) { return send(name,v); };+ var e = document.createEvent('Event');+ e.initEvent(name + '_' + elm.id, true, true);+ e.value = value;+ document.dispatchEvent(e);+ }+ function recv(name, handler) {+ document.addEventListener(name + '_' + elm.id, handler);+ }++ recv('log', function(e) {console.log(e.value)});+ recv('title', function(e) {document.title = e.value});+ recv('redirect', function(e) {+ if (e.value.length > 0) { window.location = e.value; }+ });++ function swap(newModule) {+ removeListeners(listeners);+ var div = document.createElement('div');+ var newElm = init(display, div, newModule, elm);+ inputs = [];+ // elm.send = newElm.send;+ // elm.recv = newElm.recv;+ // elm.swap = newElm.swap;+ return newElm;+ }++ var Module = {};+ var reportAnyErrors = function() {};+ try {+ Module = module.make(elm);+ } catch(e) {+ var directions = "<br/> Open the developer console for more details."+ Module.main = Elm.Text.make(elm).text('<code>' + e.message + directions + '</code>');+ reportAnyErrors = function() { throw e; }+ }+ inputs = ElmRuntime.filterDeadInputs(inputs);+ filterListeners(inputs, listeners);+ if (display !== ElmRuntime.Display.NONE) {+ var graphicsNode = initGraphics(elm, Module);+ }+ if (typeof moduleToReplace !== 'undefined') {+ ElmRuntime.swap(moduleToReplace, elm);++ // rerender scene if graphics are enabled.+ if (typeof graphicsNode !== 'undefined') {+ graphicsNode.recv(0, true, 0);+ }+ }++ reportAnyErrors();+ return { send:send, recv:recv, swap:swap };+};++function filterListeners(inputs, listeners) {+ loop:+ for (var i = listeners.length; i--; ) {+ var listener = listeners[i];+ for (var j = inputs.length; j--; ) {+ if (listener.relevantInputs.indexOf(inputs[j].id) >= 0) {+ continue loop;+ }+ }+ listener.domNode.removeEventListener(listener.eventName, listener.func);+ }+}++function removeListeners(listeners) {+ for (var i = listeners.length; i--; ) {+ var listener = listeners[i];+ listener.domNode.removeEventListener(listener.eventName, listener.func);+ }+}++function initGraphics(elm, Module) {+ if (!('main' in Module))+ throw new Error("'main' is missing! What do I display?!");++ var signalGraph = Module.main;++ // make sure the signal graph is actually a signal & extract the visual model+ var Signal = Elm.Signal.make(elm);+ if (!('recv' in signalGraph)) {+ signalGraph = Signal.constant(signalGraph);+ }+ var currentScene = signalGraph.value;+ + // Add the currentScene to the DOM+ var Render = ElmRuntime.use(ElmRuntime.Render.Element);+ elm.node.appendChild(Render.render(currentScene));+ + // set up updates so that the DOM is adjusted as necessary.+ function domUpdate(newScene, currentScene) {+ ElmRuntime.draw(function(_) {+ Render.update(elm.node.firstChild, currentScene, newScene);+ if (elm.Native.Window) elm.Native.Window.values.resizeIfNeeded();+ });+ return newScene;+ }+ var renderer = A3(Signal.foldp, F2(domUpdate), currentScene, signalGraph);++ // must check for resize after 'renderer' is created so+ // that changes show up.+ if (elm.Native.Window) elm.Native.Window.values.resizeIfNeeded();++ return renderer;+}++}());+(function() {+'use strict';++ElmRuntime.Display = { FULLSCREEN: 0, COMPONENT: 1, NONE: 2 };++ElmRuntime.counter = 0;+ElmRuntime.guid = function() { return ElmRuntime.counter++; }++ElmRuntime.use = function(M) {+ if (typeof M === 'function') M = M();+ return M;+};++function isAlive(input) {+ if (!('defaultNumberOfKids' in input)) return true;+ var len = input.kids.length;+ if (len === 0) return false;+ if (len > input.defaultNumberOfKids) return true;+ var alive = false;+ for (var i = len; i--; ) {+ alive = alive || isAlive(input.kids[i]);+ }+ return alive;+}++ElmRuntime.filterDeadInputs = function(inputs) {+ var temp = [];+ for (var i = inputs.length; i--; ) {+ if (isAlive(inputs[i])) temp.push(inputs[i]);+ }+ return temp;+};++// define the draw function+var vendors = ['ms', 'moz', 'webkit', 'o'];+for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {+ window.requestAnimationFrame = window[vendors[i]+'RequestAnimationFrame'];+ window.cancelAnimationFrame = window[vendors[i]+'CancelAnimationFrame'] ||+ window[vendors[i]+'CancelRequestAnimationFrame'];+}++if (window.requestAnimationFrame && window.cancelAnimationFrame) {+ var previous = 0;+ ElmRuntime.draw = function(callback) {+ window.cancelAnimationFrame(previous);+ previous = window.requestAnimationFrame(callback);+ };+} else {+ ElmRuntime.draw = function(callback) { callback(); };+}++}());++ElmRuntime.Render.Collage = function() {++var Render = ElmRuntime.use(ElmRuntime.Render.Element);+var Transform = Elm.Transform2D.make({});+var Utils = ElmRuntime.use(ElmRuntime.Render.Utils);+var newElement = Utils.newElement,+ extract = Utils.extract, fromList = Utils.fromList,+ fromString = Utils.fromString, addTransform = Utils.addTransform;++function trace(ctx, path) {+ var points = fromList(path);+ var i = points.length - 1;+ if (i <= 0) return;+ ctx.moveTo(points[i]._0, points[i]._1);+ while (i--) { ctx.lineTo(points[i]._0, points[i]._1); }+ if (path.closed) {+ i = points.length - 1;+ ctx.lineTo(points[i]._0, points[i]._1);+ }+}++function line(ctx,style,path) {+ style.dashing.ctor === 'Nil' ? trace(ctx, path) : customLineHelp(ctx, style, path);+ ctx.scale(1,-1);+ ctx.stroke();+}++function customLineHelp(ctx, style, path) {+ var points = fromList(path);+ if (path.closed) points.push(points[0]);+ var pattern = fromList(style.dashing);+ var i = points.length - 1;+ if (i <= 0) return;+ var x0 = points[i]._0, y0 = points[i]._1;+ var x1=0, y1=0, dx=0, dy=0, remaining=0, nx=0, ny=0;+ var pindex = 0, plen = pattern.length;+ var draw = true, segmentLength = pattern[0];+ ctx.moveTo(x0,y0);+ while (i--) {+ x1 = points[i]._0; y1 = points[i]._1;+ dx = x1 - x0; dy = y1 - y0;+ remaining = Math.sqrt(dx * dx + dy * dy);+ while (segmentLength <= remaining) {+ x0 += dx * segmentLength / remaining;+ y0 += dy * segmentLength / remaining;+ ctx[draw ? 'lineTo' : 'moveTo'](x0, y0);+ // update starting position+ dx = x1 - x0; dy = y1 - y0;+ remaining = Math.sqrt(dx * dx + dy * dy);+ // update pattern+ draw = !draw;+ pindex = (pindex + 1) % plen;+ segmentLength = pattern[pindex];+ }+ if (remaining > 0) {+ ctx[draw ? 'lineTo' : 'moveTo'](x1, y1);+ segmentLength -= remaining;+ }+ x0 = x1; y0 = y1;+ }+}++function drawLine(ctx, style, path) {+ ctx.lineWidth = style.width;+ var cap = style.cap.ctor;+ ctx.lineCap = cap === 'Flat' ? 'butt' :+ cap === 'Round' ? 'round' : 'square';+ var join = style.join.ctor;+ ctx.lineJoin = join === 'Smooth' ? 'round' :+ join === 'Sharp' ? 'miter' : 'bevel';+ ctx.miterLimit = style.join._0 || 10;+ ctx.strokeStyle = extract(style.color);+ return line(ctx, style, path);+}++function texture(redo, ctx, src) {+ var img = new Image();+ img.src = fromString(src);+ img.onload = redo;+ return ctx.createPattern(img, 'repeat');+}++function gradient(ctx, grad) {+ var g;+ var stops = [];+ if (grad.ctor === 'Linear') {+ var p0 = grad._0, p1 = grad._1;+ g = ctx.createLinearGradient(p0._0, -p0._1, p1._0, -p1._1);+ stops = fromList(grad._2);+ } else {+ var p0 = grad._0, p2 = grad._2;+ g = ctx.createRadialGradient(p0._0, -p0._1, grad._1, p2._0, -p2._1, grad._3);+ stops = fromList(grad._4);+ }+ var len = stops.length;+ for (var i = 0; i < len; ++i) {+ var stop = stops[i];+ g.addColorStop(stop._0, extract(stop._1));+ }+ return g;+}++function drawShape(redo, ctx, style, path) {+ trace(ctx, path);+ var sty = style.ctor;+ ctx.fillStyle =+ sty === 'Solid' ? extract(style._0) :+ sty === 'Texture' ? texture(redo, ctx, style._0) : gradient(ctx, style._0);+ ctx.scale(1,-1);+ ctx.fill();+}++function drawImage(redo, ctx, form) {+ var img = new Image();+ img.onload = redo;+ img.src = fromString(form._3);+ var w = form._0,+ h = form._1,+ pos = form._2,+ srcX = pos._0,+ srcY = pos._1,+ srcW = w,+ srcH = h,+ destX = -w/2,+ destY = -h/2,+ destW = w,+ destH = h;++ ctx.scale(1,-1);+ ctx.drawImage(img, srcX, srcY, srcW, srcH, destX, destY, destW, destH);+}++function renderForm(redo, ctx, form) {+ ctx.save();+ var x = form.x, y = form.y, theta = form.theta, scale = form.scale;+ if (x !== 0 || y !== 0) ctx.translate(x, y);+ if (theta !== 0) ctx.rotate(theta);+ if (scale !== 1) ctx.scale(scale,scale);+ if (form.alpha !== 1) ctx.globalAlpha = ctx.globalAlpha * form.alpha;+ ctx.beginPath();+ var f = form.form;+ switch(f.ctor) {+ case 'FPath' : drawLine(ctx, f._0, f._1); break;+ case 'FImage': drawImage(redo, ctx, f); break;+ case 'FShape':+ if (f._0.ctor === 'Left') {+ f._1.closed = true;+ drawLine(ctx, f._0._0, f._1);+ } else {+ drawShape(redo, ctx, f._0._0, f._1);+ }+ break;+ }+ ctx.restore();+}++function formToMatrix(form) {+ var scale = form.scale;+ var matrix = A6( Transform.matrix, scale, 0, 0, scale, form.x, form.y );++ var theta = form.theta+ if (theta !== 0)+ matrix = A2( Transform.multiply, matrix, Transform.rotation(theta) );++ return matrix;+}++function str(n) {+ if (n < 0.00001 && n > -0.00001) return 0;+ return n;+}++function makeTransform(w, h, form, matrices) {+ var props = form.form._0.props;+ var m = A6( Transform.matrix, 1, 0, 0, 1,+ (w - props.width)/2,+ (h - props.height)/2 );+ var len = matrices.length;+ for (var i = 0; i < len; ++i) { m = A2( Transform.multiply, m, matrices[i] ); }+ m = A2( Transform.multiply, m, formToMatrix(form) );++ return 'matrix(' + str( m[0]) + ',' + str( m[3]) + ',' ++ str(-m[1]) + ',' + str(-m[4]) + ',' ++ str( m[2]) + ',' + str( m[5]) + ')';+}++function stepperHelp(list) {+ var arr = fromList(list);+ var i = 0;+ function peekNext() {+ return i < arr.length ? arr[i].form.ctor : '';+ }+ // assumes that there is a next element+ function next() {+ var out = arr[i];+ ++i;+ return out;+ }+ return { peekNext:peekNext, next:next };+}++function stepper(forms) {+ var ps = [stepperHelp(forms)];+ var matrices = [];+ var alphas = [];+ function peekNext() {+ var len = ps.length;+ var formType = '';+ for (var i = 0; i < len; ++i ) {+ if (formType = ps[i].peekNext()) return formType;+ }+ return '';+ }+ // assumes that there is a next element+ function next(ctx) {+ while (!ps[0].peekNext()) {+ ps.shift();+ matrices.pop();+ alphas.shift();+ if (ctx) { ctx.restore(); }+ }+ var out = ps[0].next();+ var f = out.form;+ if (f.ctor === 'FGroup') {+ ps.unshift(stepperHelp(f._1));+ var m = A2(Transform.multiply, f._0, formToMatrix(out));+ ctx.save();+ ctx.transform(m[0], m[3], m[1], m[4], m[2], m[5]);+ matrices.push(m);++ var alpha = (alphas[0] || 1) * out.alpha;+ alphas.unshift(alpha);+ ctx.globalAlpha = alpha;+ }+ return out;+ }+ function transforms() { return matrices; }+ function alpha() { return alphas[0] || 1; }+ return { peekNext:peekNext, next:next, transforms:transforms, alpha:alpha };+}++function makeCanvas(w,h) {+ var canvas = newElement('canvas');+ canvas.style.width = w + 'px';+ canvas.style.height = h + 'px';+ canvas.style.display = "block";+ canvas.style.position = "absolute";+ canvas.width = w;+ canvas.height = h;+ return canvas;+}++function render(model) {+ var div = newElement('div');+ update(div, model, model);+ return div;+}++function updateTracker(w,h,div) {+ var kids = div.childNodes;+ var i = 0;+ function transform(transforms, ctx) {+ ctx.translate(w/2, h/2);+ ctx.scale(1,-1);+ var len = transforms.length;+ for (var i = 0; i < len; ++i) {+ var m = transforms[i];+ ctx.save();+ ctx.transform(m[0], m[3], m[1], m[4], m[2], m[5]);+ }+ return ctx;+ }+ function getContext(transforms) {+ while (i < kids.length) {+ var node = kids[i];+ if (node.getContext) {+ node.width = w;+ node.height = h;+ node.style.width = w + 'px';+ node.style.height = h + 'px';+ ++i;+ return transform(transforms, node.getContext('2d'));+ }+ div.removeChild(node);+ }+ var canvas = makeCanvas(w,h);+ div.appendChild(canvas);+ // we have added a new node, so we must step our position+ ++i;+ return transform(transforms, canvas.getContext('2d'));+ }+ function element(matrices, alpha, form) {+ var container = kids[i];+ if (!container || container.getContext) {+ container = newElement('div');+ container.style.overflow = 'hidden';+ container.style.position = 'absolute';+ addTransform(container.style, 'scaleY(-1)');+ + var kid = kids[i];+ kid ? div.insertBefore(container, kid)+ : div.appendChild(container);+ }+ // we have added a new node, so we must step our position+ ++i;++ container.style.width = w + 'px';+ container.style.height = h + 'px';+ container.style.opacity = alpha * form.alpha;++ var elem = form.form._0;+ var node = container.firstChild;+ if (node) {+ Render.update(node, node.oldElement, elem);+ node = container.firstChild;+ } else {+ node = Render.render(elem);+ container.appendChild(node);+ }+ node.oldElement = elem;+ addTransform(node.style, makeTransform(w, h, form, matrices));+ }+ function clearRest() {+ while (i < kids.length) {+ div.removeChild(kids[i]);+ }+ }+ return { getContext:getContext, element:element, clearRest:clearRest };+}+++function update(div, _, model) {+ var w = model.w;+ var h = model.h;+ div.style.width = w + 'px';+ div.style.height = h + 'px';+ if (model.forms.ctor === 'Nil') {+ while (div.hasChildNodes()) {+ div.removeChild(div.lastChild);+ }+ }+ var stpr = stepper(model.forms);+ var tracker = updateTracker(w,h,div);+ var ctx = null;+ var formType = '';++ while (formType = stpr.peekNext()) {+ if (ctx === null && formType !== 'FElement') {+ ctx = tracker.getContext(stpr.transforms());+ ctx.globalAlpha = stpr.alpha();+ }+ var form = stpr.next(ctx);+ if (formType === 'FElement') {+ tracker.element(stpr.transforms(), stpr.alpha(), form);+ ctx = null;+ } else if (formType !== 'FGroup') {+ renderForm(function() { update(div, model, model); }, ctx, form);+ }+ }+ tracker.clearRest();+ return false;+}++return { render:render, update:update };++};++ElmRuntime.Render.Element = function() {+'use strict';++var Utils = ElmRuntime.use(ElmRuntime.Render.Utils);+var newElement = Utils.newElement, extract = Utils.extract,+ addTransform = Utils.addTransform, removeTransform = Utils.removeTransform,+ fromList = Utils.fromList, eq = Utils.eq;++function setProps(props, e) {+ e.style.width = (props.width |0) + 'px';+ e.style.height = (props.height|0) + 'px';+ if (props.opacity !== 1) { e.style.opacity = props.opacity; }+ if (props.color.ctor === 'Just') {+ e.style.backgroundColor = extract(props.color._0);+ }+ if (props.tag !== '') { e.id = props.tag; }+ if (props.href !== '') {+ var a = newElement('a');+ a.href = props.href;+ a.style.width = '100%';+ a.style.height = '100%';+ a.style.top = 0;+ a.style.left = 0;+ a.style.display = 'block';+ a.style.position = 'absolute';+ e.style.position = 'relative';+ e.appendChild(a);+ }+ if (props.hover.ctor !== '_Tuple0') {+ var overCount = 0;+ e.addEventListener('mouseover', function() {+ if (overCount++ > 0) return;+ props.hover(true);+ });+ e.addEventListener('mouseout', function(evt) {+ if (e.contains(evt.toElement || evt.relatedTarget)) return;+ overCount = 0;+ props.hover(false);+ });+ }+ return e;+}++function image(props, img) {+ switch (img._0.ctor) {+ case 'Plain': return plainImage(img._3);+ case 'Fitted': return fittedImage(props.width, props.height, img._3);+ case 'Cropped': return croppedImage(img,props.width,props.height,img._3);+ case 'Tiled': return tiledImage(img._3);+ }+}++function plainImage(src) {+ var img = newElement('img');+ img.src = src;+ img.name = src;+ img.style.display = "block";+ return img;+}++function tiledImage(src) {+ var div = newElement('div');+ div.style.backgroundImage = 'url(' + src + ')';+ return div;+}++function fittedImage(w, h, src) {+ var div = newElement('div');+ div.style.background = 'url(' + src + ') no-repeat center';+ div.style.webkitBackgroundSize = 'cover';+ div.style.MozBackgroundSize = 'cover';+ div.style.OBackgroundSize = 'cover';+ div.style.backgroundSize = 'cover';+ return div;+}++function croppedImage(elem, w, h, src) {+ var pos = elem._0._0;+ var e = newElement('div');+ e.style.overflow = "hidden";++ var img = newElement('img');+ img.onload = function() {+ var sw = w / elem._1, sh = h / elem._2;+ img.style.width = ((this.width * sw)|0) + 'px';+ img.style.height = ((this.height * sh)|0) + 'px';+ img.style.marginLeft = ((- pos._0 * sw)|0) + 'px';+ img.style.marginTop = ((- pos._1 * sh)|0) + 'px';+ };+ img.src = src;+ img.name = src;+ e.appendChild(img);+ return e;+}++function goIn(e) { e.style.position = 'absolute'; return e; }+function goDown(e) { return e }+function goRight(e) { e.style.styleFloat = e.style.cssFloat = "left"; return e; }+function flowWith(f, array) {+ var container = newElement('div');+ for (var i = array.length; i--; ) {+ container.appendChild(f(render(array[i])));+ }+ return container;+}++function flow(dir,elist) {+ var array = fromList(elist);+ switch(dir.ctor) {+ case "DDown": array.reverse();+ case "DUp": return flowWith(goDown,array);+ case "DRight": array.reverse();+ case "DLeft": return flowWith(goRight,array);+ case "DOut": array.reverse();+ case "DIn": return flowWith(goIn,array);+ }+}++function toPos(pos) {+ switch(pos.ctor) {+ case "Absolute": return pos._0 + "px";+ case "Relative": return (pos._0 * 100) + "%";+ }+}++// must clear right, left, top, bottom, and transform+// before calling this function+function setPos(pos,w,h,e) {+ e.style.position = 'absolute';+ e.style.margin = 'auto';+ var transform = '';+ switch(pos.horizontal.ctor) {+ case 'P': e.style.right = toPos(pos.x); e.style.removeProperty('left'); break;+ case 'Z': transform = 'translateX(' + ((-w/2)|0) + 'px) ';+ case 'N': e.style.left = toPos(pos.x); e.style.removeProperty('right'); break;+ }+ switch(pos.vertical.ctor) {+ case 'N': e.style.bottom = toPos(pos.y); e.style.removeProperty('top'); break;+ case 'Z': transform += 'translateY(' + ((-h/2)|0) + 'px)';+ case 'P': e.style.top = toPos(pos.y); e.style.removeProperty('bottom'); break;+ }+ if (transform !== '') addTransform(e.style, transform);+ return e;+}++function container(pos,elem) {+ var e = render(elem);+ setPos(pos, elem.props.width, elem.props.height, e);+ var div = newElement('div');+ div.style.position = 'relative';+ div.style.overflow = 'hidden';+ div.appendChild(e);+ return div;+}++function rawHtml(html) {+ var e = newElement('div');+ e.innerHTML = html;+ return e;+}++function render(elem) { return setProps(elem.props, makeElement(elem)); }+function makeElement(e) {+ var elem = e.element;+ switch(elem.ctor) {+ case 'Image': return image(e.props, elem);+ case 'Flow': return flow(elem._0, elem._1);+ case 'Container': return container(elem._0, elem._1);+ case 'Spacer': return newElement('div');+ case 'RawHtml': return rawHtml(elem._0);+ case 'Custom': return elem.render(elem.model);+ }+}++function update(node, curr, next) {+ if (node.tagName === 'A') { node = node.firstChild; }+ if (curr.props.id === next.props.id) return updateProps(node, curr, next);+ if (curr.element.ctor !== next.element.ctor) {+ node.parentNode.replaceChild(render(next),node);+ return true;+ }+ var nextE = next.element, currE = curr.element;+ switch(nextE.ctor) {+ case "Spacer": break;+ case "RawHtml":+ if (nextE._0 !== currE._0) node.innerHTML = nextE._0;+ break;+ case "Image":+ if (nextE._0.ctor === 'Plain') {+ if (nextE._3 !== currE._3) node.src = nextE._3;+ } else if (!eq(nextE,currE) ||+ next.props.width !== curr.props.width ||+ next.props.height !== curr.props.height) {+ node.parentNode.replaceChild(render(next),node);+ return true;+ }+ break;+ case "Flow":+ var arr = fromList(nextE._1);+ for (var i = arr.length; i--; ) { arr[i] = arr[i].element.ctor; }+ if (nextE._0.ctor !== currE._0.ctor) {+ node.parentNode.replaceChild(render(next),node);+ return true;+ }+ var nexts = fromList(nextE._1);+ var kids = node.childNodes;+ if (nexts.length !== kids.length) {+ node.parentNode.replaceChild(render(next),node);+ return true;+ }+ var currs = fromList(currE._1);+ var goDir = function(x) { return x; };+ switch(nextE._0.ctor) {+ case "DDown": case "DUp": goDir = goDown; break;+ case "DRight": case "DLeft": goDir = goRight; break;+ case "DOut": case "DIn": goDir = goIn; break;+ }+ for (var i = kids.length; i-- ;) {+ update(kids[i],currs[i],nexts[i]);+ goDir(kids[i]);+ }+ break;+ case "Container":+ update(node.firstChild, currE._1, nextE._1)+ setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, node.firstChild);+ break;+ case "Custom":+ if (currE.type === nextE.type) {+ var done = nextE.update(node, currE.model, nextE.model);+ if (done) return;+ } else {+ return node.parentNode.replaceChild(render(next), node);+ }+ }+ updateProps(node, curr, next);+}++function updateProps(node, curr, next) {+ var props = next.props, currP = curr.props, e = node;+ if (props.width !== currP.width) e.style.width = (props.width |0) + 'px';+ if (props.height !== currP.height) e.style.height = (props.height|0) + 'px';+ if (props.opacity !== 1 && props.opacity !== currP.opacity) {+ e.style.opacity = props.opacity;+ }+ var nextColor = (props.color.ctor === 'Just' ?+ extract(props.color._0) : '');+ if (e.style.backgroundColor !== nextColor) {+ e.style.backgroundColor = (nextColor === '' ? 'transparent' : nextColor);+ }+ if (props.tag !== currP.tag) { e.id = props.tag; }+ if (props.href !== currP.href) {+ if (currP.href === '') {+ var a = newElement('a');+ a.href = props.href;+ a.style.width = '100%';+ a.style.height = '100%';+ a.style.top = 0;+ a.style.left = 0;+ a.style.display = 'block';+ a.style.position = 'absolute';+ e.style.position = 'relative';+ e.appendChild(a);+ } else {+ node.lastNode.href = props.href;+ }+ }+}++return { render:render, update:update };++};+ElmRuntime.Render.Utils = function() {++function newElement(elementType) {+ var e = document.createElement(elementType); + e.style.padding = "0";+ e.style.margin = "0";+ return e;+}++function addTo(container, elem) {+ container.appendChild(elem);+}++function extract(c) {+ if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }+ return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';+}++function addTransform(style, trans) {+ style.transform = trans;+ style.msTransform = trans;+ style.MozTransform = trans;+ style.webkitTransform = trans;+ style.OTransform = trans;+}++function removeTransform(style) {+ style.transform = 'none';+ style.msTransform = 'none';+ style.MozTransform = 'none';+ style.webkitTransform = 'none';+ style.OTransform = 'none';+}++var List = Elm.Native.List.make({});++return {addTo:addTo,+ newElement:newElement,+ extract : extract,+ fromList: List.toArray,+ fromString: function(s) { return s; },+ toString: function(s) { return s; },+ eq: Elm.Native.Utils.make({}).eq, addTransform: addTransform, removeTransform: removeTransform };
data/interfaces.data view
binary file changed (100823 → 105776 bytes)
− tests/Everything.hs
@@ -1,7 +0,0 @@-module Everything where--import System.Exit--main = do- putStrLn "This test always fails"- exitFailure
+ tests/Main.hs view
@@ -0,0 +1,22 @@+module Main where++import System.Directory+import System.Exit (exitWith)+import System.Environment (getArgs)+import Test.Framework.TestManager+import Test.Framework.BlackBoxTest++main :: IO () +main = do+ args <- getArgs+ tests <- blackBoxTests "tests" "dist/build/elm/elm" ".elm" bbtArgs+ code <- runTestWithArgs args tests+ removeDirectoryRecursive "cache"+ removeDirectoryRecursive "build"+ exitWith code++bbtArgs = defaultBBTArgs { bbtArgs_stdoutDiff = ignoreDiff+ , bbtArgs_stderrDiff = ignoreDiff }++ignoreDiff :: Diff+ignoreDiff _ _ = return Nothing