@liascript/editor 1.1.6--0.15.12 → 1.1.7--0.15.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/LICENSE +0 -11
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/README.md +0 -172
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/docs.json +0 -1
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/LICENSE +0 -27
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/README.md +0 -107
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/README.md +0 -51
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/LICENSE +0 -21
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/README.md +0 -313
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/LICENSE +0 -202
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/README.md +0 -820
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/LICENSE +0 -24
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/README.md +0 -7
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/README.md +0 -57
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/README.md +0 -58
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/browser/1.0.2/LICENSE +0 -11
- package/.elm/0.19.1/packages/elm/browser/1.0.2/README.md +0 -21
- package/.elm/0.19.1/packages/elm/browser/1.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/browser/1.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/README.md +0 -56
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/core/1.0.5/LICENSE +0 -11
- package/.elm/0.19.1/packages/elm/core/1.0.5/README.md +0 -30
- package/.elm/0.19.1/packages/elm/core/1.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/core/1.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/file/1.0.5/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/file/1.0.5/README.md +0 -127
- package/.elm/0.19.1/packages/elm/file/1.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/file/1.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/html/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/html/1.0.0/README.md +0 -50
- package/.elm/0.19.1/packages/elm/html/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/html/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/http/2.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/http/2.0.0/README.md +0 -36
- package/.elm/0.19.1/packages/elm/http/2.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/http/2.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/json/1.1.3/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/json/1.1.3/README.md +0 -63
- package/.elm/0.19.1/packages/elm/json/1.1.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/json/1.1.3/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/random/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/random/1.0.0/README.md +0 -46
- package/.elm/0.19.1/packages/elm/random/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/random/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/regex/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/regex/1.0.0/README.md +0 -59
- package/.elm/0.19.1/packages/elm/regex/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/regex/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/svg/1.0.1/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/svg/1.0.1/README.md +0 -62
- package/.elm/0.19.1/packages/elm/svg/1.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/svg/1.0.1/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/time/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/time/1.0.0/README.md +0 -94
- package/.elm/0.19.1/packages/elm/time/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/time/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/url/1.0.0/LICENSE +0 -27
- package/.elm/0.19.1/packages/elm/url/1.0.0/README.md +0 -32
- package/.elm/0.19.1/packages/elm/url/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/url/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/README.md +0 -5
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/docs.json +0 -1
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/LICENSE +0 -21
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/README.md +0 -19
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/README.md +0 -31
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/docs.json +0 -1
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/README.md +0 -73
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/LICENSE +0 -373
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/README.md +0 -77
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/LICENSE +0 -9
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/README.md +0 -112
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/LICENSE +0 -11
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/README.md +0 -67
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/docs.json +0 -1
- package/.elm/0.19.1/packages/lock +0 -0
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/LICENSE +0 -27
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/README.md +0 -32
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/LICENSE +0 -25
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/README.md +0 -14
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/registry.dat +0 -0
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/README.md +0 -13
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/LICENSE +0 -27
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/README.md +0 -72
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/docs.json +0 -1
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/LICENSE +0 -22
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/README.md +0 -27
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/docs.json +0 -1
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/LICENSE +0 -27
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/README.md +0 -34
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/LICENSE +0 -29
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/README.md +0 -8
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/docs.json +0 -1
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"SvgBob","comment":" Convert ASCII to SVG\n\nIt is a fork of Ivan Ceras example that is hosted at:\n\n<https://github.com/ivanceras/elm-examples>\n\n@docs getSvg, defaultOptions, getSvgWith, getElements, drawElements\n\n@docs Settings, Configuration\n\n@docs setColors, setColorsIn\n\n","unions":[],"aliases":[{"name":"Configuration","comment":" This record is used to store all relevant data to draw an svg-image multiple\ntimes, without re-parsing it.\n","args":["a"],"type":"{ svg : List.List ( SvgBob.Types.Point, SvgBob.Types.Element ), foreign : List.List ( a, ( SvgBob.Types.Point, ( Basics.Int, Basics.Int ) ) ), settings : SvgBob.Settings, columns : Basics.Int, rows : Basics.Int }"},{"name":"Settings","comment":" general settings ...\n\n type alias Settings =\n { fontSize : Float\n , lineWidth : Float\n , textWidth : Float\n , textHeight : Float\n , arcRadius : Float\n , color :\n { stroke : String\n , text : String\n , background : String\n }\n , verbatim :\n { string : String\n , multiline : Bool\n , height : Maybe String\n , width : Maybe String\n }\n }\n\nThe additional `verbatim.height` and `verbatim.width` can be used to overwrite the\ncalculated dimensions for that specific element. Otherwise the dimensions for\nverbatim elements are calculated on the basis of the position and dimensions\nof the strings within the ASCII-Art image.\n\n","args":[],"type":"SvgBob.Model.Settings"}],"values":[{"name":"defaultOptions","comment":" Default parameters to work with ...\n\n defaultOptions =\n { fontSize = 14.0\n , lineWidth = 1.0\n , textWidth = 8.0\n , textHeight = 16.0\n , arcRadius = 4.0\n , color =\n { stroke = \"#222\"\n , text = \"black\"\n , background = \"white\"\n }\n , verbatim =\n { string = \"\\\"\"\n , multiline = False\n , height = Nothing\n , width = Nothing\n }\n }\n\n","type":"SvgBob.Settings"},{"name":"drawElements","comment":" Use this to draw the result of the getElements function into an svg container.\nThe function that translates foreign objects into Svg elements is mandatory.\n","type":"List.List (Svg.Attribute msg) -> (a -> Svg.Svg msg) -> SvgBob.Configuration a -> Html.Html msg"},{"name":"getElements","comment":" Identified elements can be stored for later usage and verbatim code can be\nexposed, so that it can be transformed into any other kind of representation.\n\nThe foreign part can be translated into anything, strings are not mandatory.\nThis way it can also be used within your model, if those foreign elements are\nused to store more relevant information.\n\nUse this function in conjunction with `drawElements`.\n\n","type":"SvgBob.Settings -> String.String -> SvgBob.Configuration String.String"},{"name":"getSvg","comment":" Get the resulting svg and pass it into a div or whatever\n","type":"List.List (Svg.Attribute msg) -> String.String -> SvgBob.Settings -> Html.Html msg"},{"name":"getSvgWith","comment":" Get the resulting svg and pass it into a div or parse it further or do whatever ...\n","type":"(String.String -> Svg.Svg msg) -> List.List (Svg.Attribute msg) -> String.String -> SvgBob.Settings -> Html.Html msg"},{"name":"setColors","comment":" Helper for changing the color settings.\n\n settings\n |> setColors { stroke = \"red\", text = \"green\", background = \"blue\" }\n |> getSvg [] ...\n\n","type":"SvgBob.Model.Colors -> SvgBob.Settings -> SvgBob.Settings"},{"name":"setColorsIn","comment":" Helper for changing the color configuration.\n\n config\n |> setColorsIn { stroke = \"red\", text = \"green\", background = \"blue\" }\n |> drawElements [] ...\n\n","type":"SvgBob.Model.Colors -> SvgBob.Configuration a -> SvgBob.Configuration a"}],"binops":[]}]
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015, Bogdan Paul Popa
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
|
6
|
-
* Redistributions of source code must retain the above copyright
|
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
|
10
|
-
documentation and/or other materials provided with the distribution.
|
|
11
|
-
* Neither the name of the <organization> nor the
|
|
12
|
-
names of its contributors may be used to endorse or promote products
|
|
13
|
-
derived from this software without specific prior written permission.
|
|
14
|
-
|
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
-
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
19
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# parser-combinators
|
|
2
|
-
|
|
3
|
-
[](https://travis-ci.org/elm-community/parser-combinators)
|
|
4
|
-
|
|
5
|
-
A parser combinator library for [Elm](http://elm-lang.org). See the
|
|
6
|
-
documentation of the `Combine` module for more information and the
|
|
7
|
-
`examples` directory for complex usage examples.
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Combine","comment":" This library provides facilities for parsing structured text data\ninto concrete Elm values.\n\n\n## API Reference\n\n - [Core Types](#core-types)\n - [Running Parsers](#running-parsers)\n - [Constructing Parsers](#constructing-parsers)\n - [Parsers](#parsers)\n - [Combinators](#combinators)\n - [Transforming Parsers](#transforming-parsers)\n - [Chaining Parsers](#chaining-parsers)\n - [Parser Combinators](#parser-combinators)\n - [State Combinators](#state-combinators)\n\n\n## Core Types\n\n@docs Parser, InputStream, ParseLocation, ParseContext, ParseResult, ParseError, ParseOk\n\n\n## Running Parsers\n\n@docs parse, runParser\n\n\n## Constructing Parsers\n\n@docs primitive, app, lazy\n\n\n## Parsers\n\n@docs fail, succeed, string, regex, regexSub, regexWith, regexWithSub, end, whitespace, whitespace1\n\n\n## Combinators\n\n\n### Transforming Parsers\n\n@docs map, onsuccess, mapError, onerror\n\n\n### Chaining Parsers\n\n@docs andThen, andMap, sequence\n\n\n### Parser Combinators\n\n@docs lookAhead, while, or, choice, optional, maybe, many, many1, manyTill, many1Till, sepBy, sepBy1, sepEndBy, sepEndBy1, skip, skipMany, skipMany1, chainl, chainr, count, between, parens, braces, brackets, keep, ignore\n\n\n### State Combinators\n\n@docs withState, putState, modifyState, withLocation, withLine, withColumn, withSourceLine, currentLocation, currentSourceLine, currentLine, currentColumn, currentStream, modifyInput, modifyPosition\n\n","unions":[{"name":"Parser","comment":" The Parser type.\n\nAt their core, `Parser`s wrap functions from some `state` and an\n`InputStream` to a tuple representing the new `state`, the\nremaining `InputStream` and a `ParseResult res`.\n\n","args":["state","res"],"cases":[]}],"aliases":[{"name":"InputStream","comment":" The input stream over which `Parser`s operate.\n\n - `data` is the initial input provided by the user\n - `input` is the remainder after running a parse\n - `position` is the starting position of `input` in `data` after a parse\n\n","args":[],"type":"{ data : String.String, input : String.String, position : Basics.Int }"},{"name":"ParseContext","comment":" A tuple representing the current parser state, the remaining input\nstream and the parse result. Don't worry about this type unless\nyou're writing your own `primitive` parsers.\n","args":["state","res"],"type":"( state, Combine.InputStream, Combine.ParseResult res )"},{"name":"ParseError","comment":" A tuple representing a failed parse. It contains the state after\nrunning the parser, the remaining input stream and a list of\nerror messages.\n","args":["state"],"type":"( state, Combine.InputStream, List.List String.String )"},{"name":"ParseLocation","comment":" A record representing the current parse location in an InputStream.\n\n - `source` the current line of source code\n - `line` the current line number (starting at 1)\n - `column` the current column (starting at 1)\n\n","args":[],"type":"{ source : String.String, line : Basics.Int, column : Basics.Int }"},{"name":"ParseOk","comment":" A tuple representing a successful parse. It contains the state\nafter running the parser, the remaining input stream and the\nresult.\n","args":["state","res"],"type":"( state, Combine.InputStream, res )"},{"name":"ParseResult","comment":" Running a `Parser` results in one of two states:\n\n - `Ok res` when the parser has successfully parsed the input\n - `Err messages` when the parser has failed with a list of error messages.\n\n","args":["res"],"type":"Result.Result (List.List String.String) res"}],"values":[{"name":"andMap","comment":" Sequence two parsers.\n\n import Combine.Num exposing (int)\n\n plus : Parser s String\n plus = string \"+\"\n\n sum : Parser s Int\n sum =\n int\n |> map (+)\n |> andMap (plus |> keep int)\n\n parse sum \"1+2\"\n -- Ok 3\n\n","type":"Combine.Parser s a -> Combine.Parser s (a -> b) -> Combine.Parser s b"},{"name":"andThen","comment":" Sequence two parsers, passing the result of the first parser to a\nfunction that returns the second parser. The value of the second\nparser is returned on success.\n\n import Combine.Num exposing (int)\n\n choosy : Parser s String\n choosy =\n let\n createParser n =\n if n % 2 == 0 then\n string \" is even\"\n else\n string \" is odd\"\n in\n int\n |> andThen createParser\n\n parse choosy \"1 is odd\"\n -- Ok \" is odd\"\n\n parse choosy \"2 is even\"\n -- Ok \" is even\"\n\n parse choosy \"1 is even\"\n -- Err [\"expected \\\" is odd\\\"\"]\n\n","type":"(a -> Combine.Parser s b) -> Combine.Parser s a -> Combine.Parser s b"},{"name":"app","comment":" Unwrap a parser so it can be applied to a state and an input\nstream. This function is useful if you want to construct your own\nparsers via `primitive`. If you're using this outside of the context\nof `primitive` then you might be doing something wrong so try asking\nfor help on the mailing list.\n\nHere's how you would implement a greedy version of `manyTill` using\n`primitive` and `app`:\n\n manyTill : Parser s a -> Parser s x -> Parser s (List a)\n manyTill p end =\n let\n accumulate acc state stream =\n case app end state stream of\n ( rstate, rstream, Ok _ ) ->\n ( rstate, rstream, Ok (List.reverse acc) )\n\n _ ->\n case app p state stream of\n ( rstate, rstream, Ok res ) ->\n accumulate (res :: acc) rstate rstream\n\n ( estate, estream, Err ms ) ->\n ( estate, estream, Err ms )\n in\n primitive <| accumulate []\n\n","type":"Combine.Parser state res -> state -> Combine.InputStream -> Combine.ParseContext state res"},{"name":"between","comment":" Parse something between two other parsers.\n\nThe parser\n\n between (string \"(\") (string \")\") (string \"a\")\n\nis equivalent to the parser\n\n string \"(\" |> keep (string \"a\") |> ignore (string \")\")\n\n","type":"Combine.Parser s l -> Combine.Parser s r -> Combine.Parser s a -> Combine.Parser s a"},{"name":"braces","comment":" Parse something between braces `{}`.\n","type":"Combine.Parser s a -> Combine.Parser s a"},{"name":"brackets","comment":" Parse something between square brackets `[]`.\n","type":"Combine.Parser s a -> Combine.Parser s a"},{"name":"chainl","comment":" Parse one or more occurences of `p` separated by `op`, recursively\napply all functions returned by `op` to the values returned by `p`. See\nthe `examples/Calc.elm` file for an example.\n","type":"Combine.Parser s (a -> a -> a) -> Combine.Parser s a -> Combine.Parser s a"},{"name":"chainr","comment":" Similar to `chainl` but functions of `op` are applied in\nright-associative order to the values of `p`. See the\n`examples/Python.elm` file for a usage example.\n","type":"Combine.Parser s (a -> a -> a) -> Combine.Parser s a -> Combine.Parser s a"},{"name":"choice","comment":" Choose between a list of parsers.\n\n parse (choice [string \"a\", string \"b\"]) \"a\"\n -- Ok \"a\"\n\n parse (choice [string \"a\", string \"b\"]) \"b\"\n -- Ok \"b\"\n\n","type":"List.List (Combine.Parser s a) -> Combine.Parser s a"},{"name":"count","comment":" Parse `n` occurences of `p`.\n","type":"Basics.Int -> Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"currentColumn","comment":" Get the current column in the input stream.\n","type":"Combine.InputStream -> Basics.Int"},{"name":"currentLine","comment":" Get the current line in the input stream.\n","type":"Combine.InputStream -> Basics.Int"},{"name":"currentLocation","comment":" Get the current `(line, column)` in the input stream.\n","type":"Combine.InputStream -> Combine.ParseLocation"},{"name":"currentSourceLine","comment":" Get the current source line in the input stream.\n","type":"Combine.InputStream -> String.String"},{"name":"currentStream","comment":" Get the current string stream. That might be useful for applying memorization.\n","type":"Combine.InputStream -> String.String"},{"name":"end","comment":" Fail when the input is not empty.\n\n parse end \"\"\n -- Ok ()\n\n parse end \"a\"\n -- Err [\"expected end of input\"]\n\n","type":"Combine.Parser s ()"},{"name":"fail","comment":" Fail without consuming any input.\n\n parse (fail \"some error\") \"hello\"\n -- Err [\"some error\"]\n\n","type":"String.String -> Combine.Parser s a"},{"name":"ignore","comment":" Join two parsers, ignoring the result of the one on the left.\n\n unprefix : Parser s String\n unprefix =\n string \">\"\n |> ignore (while ((==) ' '))\n |> ignore (while ((/=) ' '))\n\n parse unprefix \"> a\"\n -- Ok \"a\"\n\n","type":"Combine.Parser s x -> Combine.Parser s a -> Combine.Parser s a"},{"name":"keep","comment":" Join two parsers, ignoring the result of the one on the right.\n\n unsuffix : Parser s String\n unsuffix =\n regex \"[a-z]\"\n |> keep (regex \"[!?]\")\n\n parse unsuffix \"a!\"\n -- Ok \"a\"\n\n","type":"Combine.Parser s a -> Combine.Parser s x -> Combine.Parser s a"},{"name":"lazy","comment":" Unfortunatelly this is not a real lazy function anymore, since this\nfunctionality is not accessable anymore by ordinary developers. Use this\nfunction only to avoid \"bad-recursion\" errors or use the following example\nsnippet in your code to circumvent this problem:\n\n recursion x =\n \\() -> recursion x\n\n","type":"(() -> Combine.Parser s a) -> Combine.Parser s a"},{"name":"lookAhead","comment":" Apply a parser without consuming any input on success.\n","type":"Combine.Parser s a -> Combine.Parser s a"},{"name":"many","comment":" Apply a parser zero or more times and return a list of the results.\n\n parse (many (string \"a\")) \"aaab\"\n -- Ok [\"a\", \"a\", \"a\"]\n\n parse (many (string \"a\")) \"bbbb\"\n -- Ok []\n\n parse (many (string \"a\")) \"\"\n -- Ok []\n\n","type":"Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"many1","comment":" Parse at least one result.\n\n parse (many1 (string \"a\")) \"a\"\n -- Ok [\"a\"]\n\n parse (many1 (string \"a\")) \"\"\n -- Err [\"expected \\\"a\\\"\"]\n\n","type":"Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"many1Till","comment":" Apply the first parser one or more times until second parser\nsucceeds. On success, the list of the first parser's results is returned.\n\n string \"<!--\" |> keep (many1Till anyChar (string \"-->\"))\n\n","type":"Combine.Parser s a -> Combine.Parser s end -> Combine.Parser s (List.List a)"},{"name":"manyTill","comment":" Apply the first parser zero or more times until second parser\nsucceeds. On success, the list of the first parser's results is returned.\n\n string \"<!--\" |> keep (manyTill anyChar (string \"-->\"))\n\n","type":"Combine.Parser s a -> Combine.Parser s end -> Combine.Parser s (List.List a)"},{"name":"map","comment":" Transform the result of a parser.\n\n let\n parser =\n string \"a\"\n |> map String.toUpper\n in\n parse parser \"a\"\n -- Ok \"A\"\n\n","type":"(a -> b) -> Combine.Parser s a -> Combine.Parser s b"},{"name":"mapError","comment":" Transform the error of a parser.\n\n let\n parser =\n string \"a\"\n |> mapError (always [\"bad input\"])\n in\n parse parser b\n -- Err [\"bad input\"]\n\n","type":"(List.List String.String -> List.List String.String) -> Combine.Parser s a -> Combine.Parser s a"},{"name":"maybe","comment":" Wrap the return value into a `Maybe`. Returns `Nothing` on failure.\n\n parse (maybe (string \"a\")) \"a\"\n -- Ok (Just \"a\")\n\n parse (maybe (string \"a\")) \"b\"\n -- Ok Nothing\n\n","type":"Combine.Parser s a -> Combine.Parser s (Maybe.Maybe a)"},{"name":"modifyInput","comment":" Modify the parser's InputStream input (String).\n","type":"(String.String -> String.String) -> Combine.Parser s ()"},{"name":"modifyPosition","comment":" Modify the parser's InputStream position (Int).\n","type":"(Basics.Int -> Basics.Int) -> Combine.Parser s ()"},{"name":"modifyState","comment":" Modify the parser's state.\n","type":"(s -> s) -> Combine.Parser s ()"},{"name":"onerror","comment":" Variant of `mapError` that replaces the Parser's error with a List\nof a single string.\n\n parse (string \"a\" |> onerror \"gimme an 'a'\") \"b\"\n -- Err [\"gimme an 'a'\"]\n\n","type":"String.String -> Combine.Parser s a -> Combine.Parser s a"},{"name":"onsuccess","comment":" Run a parser and return the value on the right on success.\n\n parse (string \"true\" |> onsuccess True) \"true\"\n -- Ok True\n\n parse (string \"true\" |> onsuccess True) \"false\"\n -- Err [\"expected \\\"true\\\"\"]\n\n","type":"a -> Combine.Parser s x -> Combine.Parser s a"},{"name":"optional","comment":" Return a default value when the given parser fails.\n\n letterA : Parser s String\n letterA = optional \"a\" (string \"a\")\n\n parse letterA \"a\"\n -- Ok \"a\"\n\n parse letterA \"b\"\n -- Ok \"a\"\n\n","type":"a -> Combine.Parser s a -> Combine.Parser s a"},{"name":"or","comment":" Choose between two parsers.\n\n parse (or (string \"a\") (string \"b\")) \"a\"\n -- Ok \"a\"\n\n parse (or (string \"a\") (string \"b\")) \"b\"\n -- Ok \"b\"\n\n parse (or (string \"a\") (string \"b\")) \"c\"\n -- Err [\"expected \\\"a\\\"\", \"expected \\\"b\\\"\"]\n\n","type":"Combine.Parser s a -> Combine.Parser s a -> Combine.Parser s a"},{"name":"parens","comment":" Parse something between parentheses.\n","type":"Combine.Parser s a -> Combine.Parser s a"},{"name":"parse","comment":" Parse a string. See `runParser` if your parser needs to manage\nsome internal state.\n\n import Combine.Num exposing (int)\n import String\n\n parseAnInteger : String -> Result String Int\n parseAnInteger input =\n case parse int input of\n Ok (_, stream, result) ->\n Ok result\n\n Err (_, stream, errors) ->\n Err (String.join \" or \" errors)\n\n parseAnInteger \"123\"\n -- Ok 123\n\n parseAnInteger \"abc\"\n -- Err \"expected an integer\"\n\n","type":"Combine.Parser () res -> String.String -> Result.Result (Combine.ParseError ()) (Combine.ParseOk () res)"},{"name":"primitive","comment":" Construct a new primitive Parser.\n\nIf you find yourself reaching for this function often consider opening\na [Github issue][issues] with the library to have your custom Parsers\nincluded in the standard distribution.\n\n[issues]: https://github.com/elm-community/parser-combinators/issues\n\n","type":"(state -> Combine.InputStream -> Combine.ParseContext state res) -> Combine.Parser state res"},{"name":"putState","comment":" Replace the parser's state.\n","type":"s -> Combine.Parser s ()"},{"name":"regex","comment":" Parse a Regex match.\n\nRegular expressions must match from the beginning of the input and their\nsubgroups are ignored. A `^` is added implicitly to the beginning of\nevery pattern unless one already exists.\n\n parse (regex \"a+\") \"aaaaab\"\n -- Ok \"aaaaa\"\n\n","type":"String.String -> Combine.Parser s String.String"},{"name":"regexSub","comment":" Parse a Regex match.\n\nSame as regex, but returns also submatches as the second parameter in\nthe result tuple.\n\n parse (regexSub \"a+\") \"aaaaab\"\n -- Ok (\"aaaaa\", [])\n\n","type":"String.String -> Combine.Parser s ( String.String, List.List (Maybe.Maybe String.String) )"},{"name":"regexWith","comment":" Parse a Regex match.\n\nSince, Regex now also has support for more parameters, this option was\nincluded into this package. Call `regexWith` with two additional parameters:\n`caseInsensitive` and `multiline`, which allow you to tweak your expression.\nThe rest is as follows. Regular expressions must match from the beginning\nof the input and their subgroups are ignored. A `^` is added implicitly to\nthe beginning of every pattern unless one already exists.\n\n parse (regexWith True False \"a+\") \"aaaAAaAab\"\n -- Ok \"aaaAAaAa\"\n\n","type":"Basics.Bool -> Basics.Bool -> String.String -> Combine.Parser s String.String"},{"name":"regexWithSub","comment":" Parse a Regex match.\n\nSimilar to `regexWith`, but a tuple is returned, with a list of additional\nsubmatches.\nThe rest is as follows. Regular expressions must match from the beginning\nof the input and their subgroups are ignored. A `^` is added implicitly to\nthe beginning of every pattern unless one already exists.\n\n parse (regexWithSub True False \"a+\") \"aaaAAaAab\"\n -- Ok (\"aaaAAaAa\", [])\n\n","type":"Basics.Bool -> Basics.Bool -> String.String -> Combine.Parser s ( String.String, List.List (Maybe.Maybe String.String) )"},{"name":"runParser","comment":" Parse a string while maintaining some internal state.\n\n import Combine.Num exposing (int)\n import String\n\n type alias Output =\n { count : Int\n , integers : List Int\n }\n\n statefulInt : Parse Int Int\n statefulInt =\n -- Parse an int, then increment the state and return the parsed\n -- int. It's important that we try to parse the int _first_\n -- since modifying the state will always succeed.\n int |> ignore (modifyState ((+) 1))\n\n ints : Parse Int (List Int)\n ints =\n sepBy (string \" \") statefulInt\n\n parseIntegers : String -> Result String Output\n parseIntegers input =\n case runParser ints 0 input of\n Ok (state, stream, ints) ->\n Ok { count = state, integers = ints }\n\n Err (state, stream, errors) ->\n Err (String.join \" or \" errors)\n\n parseIntegers \"\"\n -- Ok { count = 0, integers = [] }\n\n parseIntegers \"1 2 3 45\"\n -- Ok { count = 4, integers = [1, 2, 3, 45] }\n\n parseIntegers \"1 a 2\"\n -- Ok { count = 1, integers = [1] }\n\n","type":"Combine.Parser state res -> state -> String.String -> Result.Result (Combine.ParseError state) (Combine.ParseOk state res)"},{"name":"sepBy","comment":" Parser zero or more occurences of one parser separated by another.\n\n parse (sepBy (string \",\") (string \"a\")) \"b\"\n -- Ok []\n\n parse (sepBy (string \",\") (string \"a\")) \"a,a,a\"\n -- Ok [\"a\", \"a\", \"a\"]\n\n parse (sepBy (string \",\") (string \"a\")) \"a,a,b\"\n -- Ok [\"a\", \"a\"]\n\n","type":"Combine.Parser s x -> Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"sepBy1","comment":" Parse one or more occurences of one parser separated by another.\n","type":"Combine.Parser s x -> Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"sepEndBy","comment":" Parse zero or more occurences of one parser separated and\noptionally ended by another.\n\n parse (sepEndBy (string \",\") (string \"a\")) \"a,a,a,\"\n -- Ok [\"a\", \"a\", \"a\"]\n\n","type":"Combine.Parser s x -> Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"sepEndBy1","comment":" Parse one or more occurences of one parser separated and\noptionally ended by another.\n\n parse (sepEndBy1 (string \",\") (string \"a\")) \"\"\n -- Err [\"expected \\\"a\\\"\"]\n\n parse (sepEndBy1 (string \",\") (string \"a\")) \"a\"\n -- Ok [\"a\"]\n\n parse (sepEndBy1 (string \",\") (string \"a\")) \"a,\"\n -- Ok [\"a\"]\n\n","type":"Combine.Parser s x -> Combine.Parser s a -> Combine.Parser s (List.List a)"},{"name":"sequence","comment":" Run a list of parsers in sequence, accumulating the results. The\nmain use case for this parser is when you want to combine a list of\nparsers into a single, top-level, parser. For most use cases, you'll\nwant to use one of the other combinators instead.\n\n parse (sequence [string \"a\", string \"b\"]) \"ab\"\n -- Ok [\"a\", \"b\"]\n\n parse (sequence [string \"a\", string \"b\"]) \"ac\"\n -- Err [\"expected \\\"b\\\"\"]\n\n","type":"List.List (Combine.Parser s a) -> Combine.Parser s (List.List a)"},{"name":"skip","comment":" Apply a parser and skip its result.\n","type":"Combine.Parser s x -> Combine.Parser s ()"},{"name":"skipMany","comment":" Apply a parser and skip its result many times.\n","type":"Combine.Parser s x -> Combine.Parser s ()"},{"name":"skipMany1","comment":" Apply a parser and skip its result at least once.\n","type":"Combine.Parser s x -> Combine.Parser s ()"},{"name":"string","comment":" Parse an exact string match.\n\n parse (string \"hello\") \"hello world\"\n -- Ok \"hello\"\n\n parse (string \"hello\") \"goodbye\"\n -- Err [\"expected \\\"hello\\\"\"]\n\n","type":"String.String -> Combine.Parser s String.String"},{"name":"succeed","comment":" Return a value without consuming any input.\n\n parse (succeed 1) \"a\"\n -- Ok 1\n\n","type":"a -> Combine.Parser s a"},{"name":"while","comment":" Consume input while the predicate matches.\n\n parse (while ((/=) ' ')) \"test 123\"\n -- Ok \"test\"\n\n","type":"(Char.Char -> Basics.Bool) -> Combine.Parser s String.String"},{"name":"whitespace","comment":" Parse zero or more whitespace characters.\n\n parse (whitespace |> keep (string \"hello\")) \"hello\"\n -- Ok \"hello\"\n\n parse (whitespace |> keep (string \"hello\")) \" hello\"\n -- Ok \"hello\"\n\n","type":"Combine.Parser s String.String"},{"name":"whitespace1","comment":" Parse one or more whitespace characters.\n\n parse (whitespace1 |> keep (string \"hello\")) \"hello\"\n -- Err [\"whitespace\"]\n\n parse (whitespace1 |> keep (string \"hello\")) \" hello\"\n -- Ok \"hello\"\n\n","type":"Combine.Parser s String.String"},{"name":"withColumn","comment":" Get the current column and pipe it into a parser.\n","type":"(Basics.Int -> Combine.Parser s a) -> Combine.Parser s a"},{"name":"withLine","comment":" Get the current line and pipe it into a parser.\n","type":"(Basics.Int -> Combine.Parser s a) -> Combine.Parser s a"},{"name":"withLocation","comment":" Get the current position in the input stream and pipe it into a parser.\n","type":"(Combine.ParseLocation -> Combine.Parser s a) -> Combine.Parser s a"},{"name":"withSourceLine","comment":" Get the current InputStream and pipe it into a parser,\nonly for debugging purposes ...\n","type":"(String.String -> Combine.Parser s a) -> Combine.Parser s a"},{"name":"withState","comment":" Get the parser's state and pipe it into a parser.\n","type":"(s -> Combine.Parser s a) -> Combine.Parser s a"}],"binops":[]},{"name":"Combine.Char","comment":" This module contains `Char`-specific Parsers.\n\nAvoid using this module if performance is a concern. You can achieve\neverything that you can do with this module by using `Combine.regex`,\n`Combine.string` or `Combine.primitive` and, in general, those will be\nmuch faster.\n\n\n# Parsers\n\n@docs satisfy, char, anyChar, oneOf, noneOf, space, tab, newline, crlf, eol, lower, upper, digit, octDigit, hexDigit\n\n","unions":[],"aliases":[],"values":[{"name":"anyChar","comment":" Parse any character.\n\n parse anyChar \"a\" ==\n -- Ok 'a'\n\n parse anyChar \"\" ==\n -- Err [\"expected any character\"]\n\n","type":"Combine.Parser s Char.Char"},{"name":"char","comment":" Parse an exact character match.\n\n parse (char 'a') \"a\" ==\n -- Ok 'a'\n\n parse (char 'a') \"b\" ==\n -- Err [\"expected 'a'\"]\n\n","type":"Char.Char -> Combine.Parser s Char.Char"},{"name":"crlf","comment":" Parse a `\\r\\n` sequence, returning a `\\n` character.\n","type":"Combine.Parser s Char.Char"},{"name":"digit","comment":" Parse any base 10 digit.\n","type":"Combine.Parser s Char.Char"},{"name":"eol","comment":" Parse an end of line character or sequence, returning a `\\n` character.\n","type":"Combine.Parser s Char.Char"},{"name":"hexDigit","comment":" Parse any base 16 digit.\n","type":"Combine.Parser s Char.Char"},{"name":"lower","comment":" Parse any lowercase character.\n","type":"Combine.Parser s Char.Char"},{"name":"newline","comment":" Parse a `\\n` character.\n","type":"Combine.Parser s Char.Char"},{"name":"noneOf","comment":" Parse a character that is not in the given list.\n\n parse (noneOf ['a', 'b']) \"c\" ==\n -- Ok 'c'\n\n parse (noneOf ['a', 'b']) \"a\" ==\n -- Err [\"expected none of ['a','b']\"]\n\n","type":"List.List Char.Char -> Combine.Parser s Char.Char"},{"name":"octDigit","comment":" Parse any base 8 digit.\n","type":"Combine.Parser s Char.Char"},{"name":"oneOf","comment":" Parse a character from the given list.\n\n parse (oneOf ['a', 'b']) \"a\" ==\n -- Ok 'a'\n\n parse (oneOf ['a', 'b']) \"c\" ==\n -- Err [\"expected one of ['a','b']\"]\n\n","type":"List.List Char.Char -> Combine.Parser s Char.Char"},{"name":"satisfy","comment":" Parse a character matching the predicate.\n\n parse (satisfy ((==) 'a')) \"a\" ==\n -- Ok 'a'\n\n parse (satisfy ((==) 'a')) \"b\" ==\n -- Err [\"could not satisfy predicate\"]\n\n","type":"(Char.Char -> Basics.Bool) -> Combine.Parser s Char.Char"},{"name":"space","comment":" Parse a space character.\n","type":"Combine.Parser s Char.Char"},{"name":"tab","comment":" Parse a `\\t` character.\n","type":"Combine.Parser s Char.Char"},{"name":"upper","comment":" Parse any uppercase character.\n","type":"Combine.Parser s Char.Char"}],"binops":[]},{"name":"Combine.Num","comment":" This module contains Parsers specific to parsing numbers.\n\n\n# Parsers\n\n@docs sign, digit, int, float\n\n","unions":[],"aliases":[],"values":[{"name":"digit","comment":" Parse a digit.\n","type":"Combine.Parser s Basics.Int"},{"name":"float","comment":" Parse a float.\n","type":"Combine.Parser s Basics.Float"},{"name":"int","comment":" Parse an integer.\n","type":"Combine.Parser s Basics.Int"},{"name":"sign","comment":" Parse a numeric sign, returning `1` for positive numbers and `-1`\nfor negative numbers.\n","type":"Combine.Parser s Basics.Int"}],"binops":[]}]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Copyright 2018 Aaron VonderHaar
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
[](https://travis-ci.org/avh4/elm-color)
|
|
2
|
-
|
|
3
|
-
# elm-color
|
|
4
|
-
|
|
5
|
-
The this package defines a standard `Color` type
|
|
6
|
-
(taking the place of `elm-lang/core#Color` in Elm 0.18)
|
|
7
|
-
with the hope that all Elm packages that produce colors and
|
|
8
|
-
all Elm packages that consume colors will use this type
|
|
9
|
-
to allow all such packages to easily interoperate
|
|
10
|
-
for the ultimate benefit of all Elm developers.
|
|
11
|
-
(If you are a package author and find that the `Color` type here does not meet your package's
|
|
12
|
-
needs for passing colors to or from your package,
|
|
13
|
-
please [report an issue](https://github.com/avh4/elm-color/issues/new) so we can improve this package to support your needs.)
|
|
14
|
-
|
|
15
|
-
Future versions of this package will include additional common conversions
|
|
16
|
-
and color manipulation functions.
|
|
17
|
-
If you have used other color packages or written your own color-related functions in the past,
|
|
18
|
-
please [create an issue](https://github.com/avh4/elm-color/issues/new) to describe your use case
|
|
19
|
-
so we can better design additions to this package.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Example
|
|
23
|
-
|
|
24
|
-
```elm
|
|
25
|
-
import Color exposing (Color)
|
|
26
|
-
import Html exposing (Html)
|
|
27
|
-
import Html.Attributes exposing (style)
|
|
28
|
-
|
|
29
|
-
view : Color -> Html msg
|
|
30
|
-
view foreground =
|
|
31
|
-
let
|
|
32
|
-
hue =
|
|
33
|
-
(Color.toHsla foreground).hue
|
|
34
|
-
|
|
35
|
-
borderColor =
|
|
36
|
-
Color.hsla hue 0.75 0.5 0.8
|
|
37
|
-
in
|
|
38
|
-
Html.div
|
|
39
|
-
[ style "background-color" (Color.toCssString Color.lightOrange)
|
|
40
|
-
, style "color" (Color.toCssString foreground)
|
|
41
|
-
, style "border-color" (Color.toCssString borderColor)
|
|
42
|
-
]
|
|
43
|
-
[ Html.text "(ᵔᴥᵔ)" ]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Built-in colors
|
|
48
|
-
|
|
49
|
-
This package also provides an "aesthetically reasonable" set of common colors.
|
|
50
|
-
|
|
51
|
-

|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Roadmap
|
|
55
|
-
|
|
56
|
-
- [x] Initial release: defines color type and basic conversion functions
|
|
57
|
-
- [ ] 1.1.0: implement common color manipulation functions
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Color","comment":" This package defines a standard `Color` type\nwith the hope that all Elm packages that produce colors and\nall Elm packages that consume colors will use this type\nto allow all such packages to easily interoperate\nfor the ultimate benefit of all Elm developers.\n\nNote about color space conversions:\nWhen converting between RGB and HSL, this module produce results consistent with\nthe algorithm specified in the CSS Color Module Level 3,\n[Section 4.2.4. HSL color values](https://www.w3.org/TR/css-color-3/#hsl-color).\n\n\n# Types\n\n@docs Color\n\n\n# Creating colors\n\n\n## From numbers\n\nThese are the most concise ways to create colors:\n\n@docs rgb255, rgb, rgba, hsl, hsla\n\n\n## From records\n\nThese ways to make colors make the names of each component explicit,\nand are compatible with the corresponding `to...` function.\n\n@docs fromRgba, fromHsla\n\n\n# Using colors with HTML/CSS/SVG\n\n@docs toCssString\n\n\n# Extracing values from colors\n\n@docs toRgba, toHsla\n\n\n# Built-in Colors\n\nThese colors come from the [Tango palette](http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines)\nwhich provides aesthetically reasonable defaults for colors.\nEach color also comes with a light and dark version.\n\n\n## Standard\n\n@docs red, orange, yellow, green, blue, purple, brown\n\n\n## Light\n\n@docs lightRed, lightOrange, lightYellow, lightGreen, lightBlue, lightPurple, lightBrown\n\n\n## Dark\n\n@docs darkRed, darkOrange, darkYellow, darkGreen, darkBlue, darkPurple, darkBrown\n\n\n## Eight Shades of Grey\n\nThese colors are a compatible series of shades of grey, fitting nicely\nwith the Tango palette.\n\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\n@docs lightGray, gray, darkGray\n\n","unions":[{"name":"Color","comment":" Represents a color.\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"black","comment":" ","type":"Color.Color"},{"name":"blue","comment":" ","type":"Color.Color"},{"name":"brown","comment":" ","type":"Color.Color"},{"name":"charcoal","comment":" ","type":"Color.Color"},{"name":"darkBlue","comment":" ","type":"Color.Color"},{"name":"darkBrown","comment":" ","type":"Color.Color"},{"name":"darkCharcoal","comment":" ","type":"Color.Color"},{"name":"darkGray","comment":" ","type":"Color.Color"},{"name":"darkGreen","comment":" ","type":"Color.Color"},{"name":"darkGrey","comment":" ","type":"Color.Color"},{"name":"darkOrange","comment":" ","type":"Color.Color"},{"name":"darkPurple","comment":" ","type":"Color.Color"},{"name":"darkRed","comment":" ","type":"Color.Color"},{"name":"darkYellow","comment":" ","type":"Color.Color"},{"name":"fromHsla","comment":" Creates a color from [HSLA](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness, alpha)\nvalues between 0.0 and 1.0 (inclusive).\n\nSee also:\n\nIf you want to be more concise, see [`hsla`](#hsla) or [`hsl`](#hsl).\n\n","type":"{ hue : Basics.Float, saturation : Basics.Float, lightness : Basics.Float, alpha : Basics.Float } -> Color.Color"},{"name":"fromRgba","comment":" Creates a color from a record of RGBA values (red, green, blue, alpha) between 0.0 and 1.0 (inclusive).\n\nThe RGB values are interpreted in the [sRGB](https://en.wikipedia.org/wiki/SRGB) color space,\nwhich is the color space specified by the HTML, [CSS](https://www.w3.org/TR/css-color-3/#rgb-color),\nand [SVG](https://www.w3.org/Graphics/SVG/1.1/color.html) specs\n(and is also widely considered the default color space for digital images that do not explicitly contain color space information).\n\nThis is a strict function that will force you to name all channel parameters, to avoid mixing them up.\n\nSee also:\n\nIf you want to be more concise, see [`rgba`](#rgba) or [`rgb`](#rgb).\n\n","type":"{ red : Basics.Float, green : Basics.Float, blue : Basics.Float, alpha : Basics.Float } -> Color.Color"},{"name":"gray","comment":" ","type":"Color.Color"},{"name":"green","comment":" ","type":"Color.Color"},{"name":"grey","comment":" ","type":"Color.Color"},{"name":"hsl","comment":" Creates a color from [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness)\nvalues between 0.0 and 1.0 (inclusive).\n\nSee also:\n\nIf you need to provide an alpha value, see [`hsla`](#hsla).\n\nIf you want to be more explicit with parameter names, see [`fromHsla`](#fromHsla).\n\n","type":"Basics.Float -> Basics.Float -> Basics.Float -> Color.Color"},{"name":"hsla","comment":" Creates a color from [HSLA](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness, alpha)\nvalues between 0.0 and 1.0 (inclusive).\n\nSee also:\n\nIf you want to be more concise and want full alpha, see [`hsl`](#hsl).\n\nIf you want to be more explicit with parameter names, see [`fromHsla`](#fromHsla).\n\n","type":"Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> Color.Color"},{"name":"lightBlue","comment":" ","type":"Color.Color"},{"name":"lightBrown","comment":" ","type":"Color.Color"},{"name":"lightCharcoal","comment":" ","type":"Color.Color"},{"name":"lightGray","comment":" ","type":"Color.Color"},{"name":"lightGreen","comment":" ","type":"Color.Color"},{"name":"lightGrey","comment":" ","type":"Color.Color"},{"name":"lightOrange","comment":" ","type":"Color.Color"},{"name":"lightPurple","comment":" ","type":"Color.Color"},{"name":"lightRed","comment":" ","type":"Color.Color"},{"name":"lightYellow","comment":" ","type":"Color.Color"},{"name":"orange","comment":" ","type":"Color.Color"},{"name":"purple","comment":" ","type":"Color.Color"},{"name":"red","comment":" ","type":"Color.Color"},{"name":"rgb","comment":" Creates a color from RGB (red, green, blue) values between 0.0 and 1.0 (inclusive).\n\nThis is a convenience function for making a color value with full opacity.\n\nSee also:\n\nIf you want to pass RGB values as `Int` values between 0 and 255, see [`rgb255`](#rgb255).\n\nIf you need to provide an alpha value, see [`rgba`](#rgba).\n\nIf you want to be more explicit with parameter names, see [`fromRgba`](#fromRgba).\n\n","type":"Basics.Float -> Basics.Float -> Basics.Float -> Color.Color"},{"name":"rgb255","comment":" Creates a color from RGB (red, green, blue) integer values between 0 and 255.\n\nThis is a convenience function if you find passing RGB channels as integers scaled to 255 more intuitive.\n\nSee also:\n\nIf you want to provide RGB values as `Float` values between 0.0 and 1.0, see [`rgb`](#rgb).\n\n","type":"Basics.Int -> Basics.Int -> Basics.Int -> Color.Color"},{"name":"rgba","comment":" Creates a color from RGBA (red, green, blue, alpha) values between 0.0 and 1.0 (inclusive).\n\nSee also:\n\nIf you want to be more concise and want full alpha, see [`rgb`](#rgb).\n\nIf you want to be more explicit with parameter names, see [`fromRgba`](#fromRgba).\n\n","type":"Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> Color.Color"},{"name":"toCssString","comment":" Converts a color to a string suitable for use in CSS.\nThe string will conform to [CSS Color Module Level 3](https://www.w3.org/TR/css-color-3/),\nwhich is supported by all current web browsers, all versions of Firefox,\nall versions of Chrome, IE 9+, and all common mobile browsers\n([browser support details](https://caniuse.com/#feat=css3-colors)).\n\n Html.Attributes.style \"background-color\" (Color.toCssString Color.lightPurple)\n\nNote: the current implementation produces a string in the form\n`rgba(rr.rr%,gg.gg%,bb.bb%,a.aaa)`, but this may change in the\nfuture, and you should not rely on this implementation detail.\n\n","type":"Color.Color -> String.String"},{"name":"toHsla","comment":" Extract the [HSLA](https://en.wikipedia.org/wiki/HSL_and_HSV) (hue, saturation, lightness, alpha)\ncomponents from a color.\nThe component values will be between 0.0 and 1.0 (inclusive).\n","type":"Color.Color -> { hue : Basics.Float, saturation : Basics.Float, lightness : Basics.Float, alpha : Basics.Float }"},{"name":"toRgba","comment":" Extract the RGBA (red, green, blue, alpha) components from a color.\nThe component values will be between 0.0 and 1.0 (inclusive).\n\nThe RGB values are interpreted in the [sRGB](https://en.wikipedia.org/wiki/SRGB) color space,\nwhich is the color space specified by the HTML, [CSS](https://www.w3.org/TR/css-color-3/#rgb-color),\nand [SVG](https://www.w3.org/Graphics/SVG/1.1/color.html) specs\n(and is also widely considered the default color space for digital images that do not explicitly contain color space information).\n\n","type":"Color.Color -> { red : Basics.Float, green : Basics.Float, blue : Basics.Float, alpha : Basics.Float }"},{"name":"white","comment":" ","type":"Color.Color"},{"name":"yellow","comment":" ","type":"Color.Color"}],"binops":[]}]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Copyright 2018 Dan Fishgold
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Base64
|
|
2
|
-
|
|
3
|
-
This is an Elm package for encoding and decoding Base64 strings.
|
|
4
|
-
|
|
5
|
-
You can [read more about Base64 on Wikipedia][wiki],
|
|
6
|
-
but basically you can use Base64 to encode bytes in plain text.
|
|
7
|
-
|
|
8
|
-
This package allows you to convert bytes to Base64 strings with `Base64.fromBytes`
|
|
9
|
-
and convert a Base64 string to bytes with `Base64.toBytes`.
|
|
10
|
-
|
|
11
|
-
[View demo][demo]
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
elm install danfishgold/base64-bytes
|
|
16
|
-
|
|
17
|
-
### Bytes to Base64
|
|
18
|
-
|
|
19
|
-
```elm
|
|
20
|
-
|
|
21
|
-
import Bytes.Encode
|
|
22
|
-
import Base64
|
|
23
|
-
|
|
24
|
-
Bytes.Encode.string "Hello World"
|
|
25
|
-
|> Bytes.Encode.encode
|
|
26
|
-
|> Base64.fromBytes
|
|
27
|
-
|
|
28
|
-
--> Just "SGVsbG8gV29ybGQ="
|
|
29
|
-
|
|
30
|
-
Bytes.Encode.string "אהלן עולם"
|
|
31
|
-
|> Bytes.Encode.encode
|
|
32
|
-
|> Base64.fromBytes
|
|
33
|
-
|
|
34
|
-
--> Just "15DXlNec158g16LXldec150="
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Base64 to Bytes
|
|
39
|
-
|
|
40
|
-
```elm
|
|
41
|
-
|
|
42
|
-
import Bytes
|
|
43
|
-
import Bytes.Decode
|
|
44
|
-
import Base64
|
|
45
|
-
|
|
46
|
-
case Base64.toBytes "SGVsbG8gV29ybGQ=" of
|
|
47
|
-
Nothing ->
|
|
48
|
-
Just "Invalid Base64 string"
|
|
49
|
-
Just bytes ->
|
|
50
|
-
Bytes.Decode.decode (Bytes.Decode.string (Bytes.width bytes)) bytes
|
|
51
|
-
|
|
52
|
-
--> Just "Hello World"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
[wiki]: https://en.wikipedia.org/wiki/Base64
|
|
58
|
-
[demo]: https://danfishgold.github.io/base64-bytes
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Base64","comment":" This package can convert\n[bytes](https://package.elm-lang.org/packages/elm/bytes/latest/)\nto Base64 strings and vice versa.\n\n\n# Conversion\n\n@docs fromBytes, fromString, toBytes, toString\n\n\n# Bytes Encoder and Decoder\n\nSlightly lower level functions.\n\n[`fromBytes`](#fromBytes) and [`toBytes`](#toBytes) functions\nare pretty much wrappers around these functions.\n\n@docs encoder, decoder\n\n","unions":[],"aliases":[],"values":[{"name":"decoder","comment":" `decoder width` is a bytes decoder that will convert `width` bytes into a\nBase64 string.\n\nIt's used in [`fromBytes`](#fromBytes):\n\n fromBytes : Bytes -> Maybe String\n fromBytes bytes =\n Bytes.Decode.decode (decoder (Bytes.width bytes)) bytes\n\n","type":"Basics.Int -> Bytes.Decode.Decoder String.String"},{"name":"encoder","comment":" `encoder` returns a bytes encoder. It fails if the string that is passed\nto it is not a valid Base64 sequence.\n\nIt's used in [`toBytes`](#toBytes):\n\n toBytes : String -> Maybe Bytes\n toBytes string =\n Maybe.map Bytes.Encode.encode (encoder string)\n\n","type":"String.String -> Maybe.Maybe Bytes.Encode.Encoder"},{"name":"fromBytes","comment":" Convert bytes to a Base64 string.\nIf you want more control over the process, you should use [`decoder`](#decoder).\n\nThis function should never return `Nothing`, but it uses\n[`Bytes.Decode.decode`](https://package.elm-lang.org/packages/elm/bytes/latest/Bytes-Decode#decode),\nwhich returns a `Maybe String`.\n\n","type":"Bytes.Bytes -> Maybe.Maybe String.String"},{"name":"fromString","comment":" Encode a string into a Base64 string.\nThis function is a wrapper around [`fromBytes`](#fromBytes).\n\nSimilarly, it should never return `Nothing`, but alas, [`Bytes.Decode.decode`](https://package.elm-lang.org/packages/elm/bytes/latest/Bytes-Decode#decode),\nwhich [`fromBytes`](#fromBytes) uses, returns a `Maybe String`.\n\n","type":"String.String -> Maybe.Maybe String.String"},{"name":"toBytes","comment":" Convert a Base64 string to bytes.\nIf you want more control over the process, you should use [`encoder`](#encoder).\n\nThis function fails (returns `Nothing`) if you give it an invalid Base64 sequence.\n\n","type":"String.String -> Maybe.Maybe Bytes.Bytes"},{"name":"toString","comment":" Decode a Base64 string into a string.\nThis function is a wrapper around [`toBytes`](#toBytes).\n\nIt will fail (return `Nothing`) if you give it an invalid Base64 sequence.\n\n","type":"String.String -> Maybe.Maybe String.String"}],"binops":[]}]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Copyright 2017-present Evan Czaplicki
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Elm in the Browser!
|
|
2
|
-
|
|
3
|
-
This package allows you to create Elm programs that run in browsers.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Learning Path
|
|
7
|
-
|
|
8
|
-
**I highly recommend working through [guide.elm-lang.org][guide] to learn how to use Elm.** It is built around a learning path that introduces concepts gradually.
|
|
9
|
-
|
|
10
|
-
[guide]: https://guide.elm-lang.org/
|
|
11
|
-
|
|
12
|
-
You can see the outline of that learning path in the `Browser` module. It lets you create Elm programs with the following functions:
|
|
13
|
-
|
|
14
|
-
1. [`sandbox`](https://package.elm-lang.org/packages/elm/browser/latest/Browser#sandbox) — react to user input, like buttons and checkboxes
|
|
15
|
-
2. [`element`](https://package.elm-lang.org/packages/elm/browser/latest/Browser#element) — talk to the outside world, like HTTP and JS interop
|
|
16
|
-
3. [`document`](https://package.elm-lang.org/packages/elm/browser/latest/Browser#document) — control the `<title>` and `<body>`
|
|
17
|
-
4. [`application`](https://package.elm-lang.org/packages/elm/browser/latest/Browser#application) — create single-page apps
|
|
18
|
-
|
|
19
|
-
This order works well because important concepts and techniques are introduced at each stage. If you jump ahead, it is like building a house by starting with the roof! So again, **work through [guide.elm-lang.org][guide] to see examples and really *understand* how Elm works!**
|
|
20
|
-
|
|
21
|
-
This order also works well because it mirrors how most people introduce Elm at work. Start small. Try using Elm in a single element in an existing JavaScript project. If that goes well, try doing a bit more. Etc.
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Browser","comment":" This module helps you set up an Elm `Program` with functions like\n[`sandbox`](#sandbox) and [`document`](#document).\n\n\n# Sandboxes\n\n@docs sandbox\n\n\n# Elements\n\n@docs element\n\n\n# Documents\n\n@docs document, Document\n\n\n# Applications\n\n@docs application, UrlRequest\n\n","unions":[{"name":"UrlRequest","comment":" All links in an [`application`](#application) create a `UrlRequest`. So\nwhen you click `<a href=\"/home\">Home</a>`, it does not just navigate! It\nnotifies `onUrlRequest` that the user wants to change the `Url`.\n\n\n### `Internal` vs `External`\n\nImagine we are browsing `https://example.com`. An `Internal` link would be\nlike:\n\n - `settings#privacy`\n - `/home`\n - `https://example.com/home`\n - `//example.com/home`\n\nAll of these links exist under the `https://example.com` domain. An `External`\nlink would be like:\n\n - `https://elm-lang.org/examples`\n - `https://other.example.com/home`\n - `http://example.com/home`\n\nAnything that changes the domain. Notice that changing the protocol from\n`https` to `http` is considered a different domain! (And vice versa!)\n\n\n### Purpose\n\nHaving a `UrlRequest` requires a case in your `update` like this:\n\n import Browser exposing (..)\n import Browser.Navigation as Nav\n import Url\n\n type Msg\n = ClickedLink UrlRequest\n\n update : Msg -> Model -> ( Model, Cmd msg )\n update msg model =\n case msg of\n ClickedLink urlRequest ->\n case urlRequest of\n Internal url ->\n ( model\n , Nav.pushUrl model.key (Url.toString url)\n )\n\n External url ->\n ( model\n , Nav.load url\n )\n\nThis is useful because it gives you a chance to customize the behavior in each\ncase. Maybe on some `Internal` links you save the scroll position with\n[`Browser.Dom.getViewport`](Browser-Dom#getViewport) so you can restore it\nlater. Maybe on `External` links you persist parts of the `Model` on your\nservers before leaving. Whatever you need to do!\n\n**Note:** Knowing the scroll position is not enough to restore it! What if the\nbrowser dimensions change? The scroll position will not correlate with\n“what was on screen” anymore. So it may be better to remember\n“what was on screen” and recreate the position based on that. For\nexample, in a Wikipedia article, remember the header that they were looking at\nmost recently. [`Browser.Dom.getElement`](Browser-Dom#getElement) is designed\nfor figuring that out!\n\n","args":[],"cases":[["Internal",["Url.Url"]],["External",["String.String"]]]}],"aliases":[{"name":"Document","comment":" This data specifies the `<title>` and all of the nodes that should go in\nthe `<body>`. This means you can update the title as your application changes.\nMaybe your \"single-page app\" navigates to a \"different page\", maybe a calendar\napp shows an accurate date in the title, etc.\n\n> **Note about CSS:** This looks similar to an `<html>` document, but this is\n> not the place to manage CSS assets. If you want to work with CSS, there are\n> a couple ways:\n>\n> 1. Packages like [`rtfeldman/elm-css`][elm-css] give all of the features\n> of CSS without any CSS files. You can add all the styles you need in your\n> `view` function, and there is no need to worry about class names matching.\n>\n> 2. Compile your Elm code to JavaScript with `elm make --output=elm.js` and\n> then make your own HTML file that loads `elm.js` and the CSS file you want.\n> With this approach, it does not matter where the CSS comes from. Write it\n> by hand. Generate it. Whatever you want to do.\n>\n> 3. If you need to change `<link>` tags dynamically, you can send messages\n> out a port to do it in JavaScript.\n>\n> The bigger point here is that loading assets involves touching the `<head>`\n> as an implementation detail of browsers, but that does not mean it should be\n> the responsibility of the `view` function in Elm. So we do it differently!\n\n[elm-css]: /packages/rtfeldman/elm-css/latest/\n\n","args":["msg"],"type":"{ title : String.String, body : List.List (Html.Html msg) }"}],"values":[{"name":"application","comment":" Create an application that manages [`Url`][url] changes.\n\n**When the application starts**, `init` gets the initial `Url`. You can show\ndifferent things depending on the `Url`!\n\n**When someone clicks a link**, like `<a href=\"/home\">Home</a>`, it always goes\nthrough `onUrlRequest`. The resulting message goes to your `update` function,\ngiving you a chance to save scroll position or persist data before changing\nthe URL yourself with [`pushUrl`][bnp] or [`load`][bnl]. More info on this in\nthe [`UrlRequest`](#UrlRequest) docs!\n\n**When the URL changes**, the new `Url` goes through `onUrlChange`. The\nresulting message goes to `update` where you can decide what to show next.\n\nApplications always use the [`Browser.Navigation`][bn] module for precise\ncontrol over `Url` changes.\n\n**More Info:** Here are some example usages of `application` programs:\n\n - [RealWorld example app](https://github.com/rtfeldman/elm-spa-example)\n - [Elm’s package website](https://github.com/elm/package.elm-lang.org)\n\nThese are quite advanced Elm programs, so be sure to go through [the guide][g]\nfirst to get a solid conceptual foundation before diving in! If you start\nreading a calculus book from page 314, it might seem confusing. Same here!\n\n**Note:** Can an [`element`](#element) manage the URL too? Read [this]!\n\n[g]: https://guide.elm-lang.org/\n[bn]: Browser-Navigation\n[bnp]: Browser-Navigation#pushUrl\n[bnl]: Browser-Navigation#load\n[url]: /packages/elm/url/latest/Url#Url\n[this]: https://github.com/elm/browser/blob/1.0.2/notes/navigation-in-elements.md\n\n","type":"{ init : flags -> Url.Url -> Browser.Navigation.Key -> ( model, Platform.Cmd.Cmd msg ), view : model -> Browser.Document msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), subscriptions : model -> Platform.Sub.Sub msg, onUrlRequest : Browser.UrlRequest -> msg, onUrlChange : Url.Url -> msg } -> Platform.Program flags model msg"},{"name":"document","comment":" Create an HTML document managed by Elm. This expands upon what `element`\ncan do in that `view` now gives you control over the `<title>` and `<body>`.\n","type":"{ init : flags -> ( model, Platform.Cmd.Cmd msg ), view : model -> Browser.Document msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), subscriptions : model -> Platform.Sub.Sub msg } -> Platform.Program flags model msg"},{"name":"element","comment":" Create an HTML element managed by Elm. The resulting elements are easy to\nembed in larger JavaScript projects, and lots of companies that use Elm\nstarted with this approach! Try it out on something small. If it works, great,\ndo more! If not, revert, no big deal.\n\nUnlike a [`sandbox`](#sandbox), an `element` can talk to the outside world in\na couple ways:\n\n - `Cmd` — you can “command” the Elm runtime to do stuff, like HTTP.\n - `Sub` — you can “subscribe” to event sources, like clock ticks.\n - `flags` — JavaScript can pass in data when starting the Elm program\n - `ports` — set up a client-server relationship with JavaScript\n\nAs you read [the guide][guide] you will run into a bunch of examples of `element`\nin [this section][fx]. You can learn more about flags and ports in [the interop\nsection][interop].\n\n[guide]: https://guide.elm-lang.org/\n[fx]: https://guide.elm-lang.org/effects/\n[interop]: https://guide.elm-lang.org/interop/\n\n","type":"{ init : flags -> ( model, Platform.Cmd.Cmd msg ), view : model -> Html.Html msg, update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), subscriptions : model -> Platform.Sub.Sub msg } -> Platform.Program flags model msg"},{"name":"sandbox","comment":" Create a “sandboxed” program that cannot communicate with the outside\nworld.\n\nThis is great for learning the basics of [The Elm Architecture][tea]. You can\nsee sandboxes in action in the following examples:\n\n - [Buttons](https://guide.elm-lang.org/architecture/buttons.html)\n - [Text Fields](https://guide.elm-lang.org/architecture/text_fields.html)\n - [Forms](https://guide.elm-lang.org/architecture/forms.html)\n\nThose are nice, but **I very highly recommend reading [this guide][guide]\nstraight through** to really learn how Elm works. Understanding the\nfundamentals actually pays off in this language!\n\n[tea]: https://guide.elm-lang.org/architecture/\n[guide]: https://guide.elm-lang.org/\n\n","type":"{ init : model, view : model -> Html.Html msg, update : msg -> model -> model } -> Platform.Program () model msg"}],"binops":[]},{"name":"Browser.Dom","comment":" This module allows you to manipulate the DOM in various ways. It covers:\n\n - Focus and blur input elements.\n - Get the `width` and `height` of elements.\n - Get the `x` and `y` coordinates of elements.\n - Figure out the scroll position.\n - Change the scroll position!\n\nWe use different terminology than JavaScript though...\n\n\n# Terminology\n\nHave you ever thought about how “scrolling” is a metaphor about\nscrolls? Like hanging scrolls of caligraphy made during the Han Dynasty\nin China?\n\nThis metaphor falls apart almost immediately though. For example, many scrolls\nread horizontally! Like a [Sefer Torah][torah] or [Chinese Handscrolls][hand].\nThe two sides move independently, sometimes kept in place with stones. What is\na scroll bar in this world? And [hanging scrolls][hang] (which _are_ displayed\nvertically) do not “scroll” at all! They hang!\n\nSo in JavaScript, we start with a badly stretched metaphor and add a bunch of\nDOM details like padding, borders, and margins. How do those relate to scrolls?\nFor example, JavaScript has `clientWidth`. Client like a feudal state that pays\ntribute to the emperor? And `offsetHeight`. Can an offset even have height? And\nwhat has that got to do with scrolls?\n\nSo instead of inheriting this metaphorical hodge-podge, we use terminology from\n3D graphics. You have a **scene** containing all your elements and a **viewport**\ninto the scene. I think it ends up being a lot clearer, but you can evaluate\nfor yourself when you see the diagrams later!\n\n**Note:** For more scroll facts, I recommend [A Day on the Grand Canal with\nthe Emperor of China or: Surface Is Illusion But So Is Depth][doc] where David\nHockney explores the history of _perspective_ in art. Really interesting!\n\n[torah]: https://en.wikipedia.org/wiki/Sefer_Torah\n[hand]: https://www.metmuseum.org/toah/hd/chhs/hd_chhs.htm\n[hang]: https://en.wikipedia.org/wiki/Hanging_scroll\n[doc]: https://www.imdb.com/title/tt0164525/\n\n\n# Focus\n\n@docs focus, blur, Error\n\n\n# Get Viewport\n\n@docs getViewport, Viewport, getViewportOf\n\n\n# Set Viewport\n\n@docs setViewport, setViewportOf\n\n\n# Position\n\n@docs getElement, Element\n\n","unions":[{"name":"Error","comment":" Many functions in this module look up DOM nodes up by their `id`. If you\nask for an `id` that is not in the DOM, you will get this error.\n","args":[],"cases":[["NotFound",["String.String"]]]}],"aliases":[{"name":"Element","comment":" A bunch of information about the position and size of an element relative\nto the overall scene.\n\n\n\n","args":[],"type":"{ scene : { width : Basics.Float, height : Basics.Float }, viewport : { x : Basics.Float, y : Basics.Float, width : Basics.Float, height : Basics.Float }, element : { x : Basics.Float, y : Basics.Float, width : Basics.Float, height : Basics.Float } }"},{"name":"Viewport","comment":" All the information about the current viewport.\n\n\n\n","args":[],"type":"{ scene : { width : Basics.Float, height : Basics.Float }, viewport : { x : Basics.Float, y : Basics.Float, width : Basics.Float, height : Basics.Float } }"}],"values":[{"name":"blur","comment":" Find a DOM node by `id` and make it lose focus. So if you wanted a node\nlike `<input type=\"text\" id=\"search-box\">` to lose focus you could say:\n\n import Browser.Dom as Dom\n import Task\n\n type Msg\n = NoOp\n\n unfocusSearchBox : Cmd Msg\n unfocusSearchBox =\n Task.attempt (\\_ -> NoOp) (Dom.blur \"search-box\")\n\nNotice that this code ignores the possibility that `search-box` is not used\nas an `id` by any node, failing silently in that case. It would be better to\nlog the failure with whatever error reporting system you use.\n\n","type":"String.String -> Task.Task Browser.Dom.Error ()"},{"name":"focus","comment":" Find a DOM node by `id` and focus on it. So if you wanted to focus a node\nlike `<input type=\"text\" id=\"search-box\">` you could say:\n\n import Browser.Dom as Dom\n import Task\n\n type Msg\n = NoOp\n\n focusSearchBox : Cmd Msg\n focusSearchBox =\n Task.attempt (\\_ -> NoOp) (Dom.focus \"search-box\")\n\nNotice that this code ignores the possibility that `search-box` is not used\nas an `id` by any node, failing silently in that case. It would be better to\nlog the failure with whatever error reporting system you use.\n\n","type":"String.String -> Task.Task Browser.Dom.Error ()"},{"name":"getElement","comment":" Get position information about specific elements. Say we put\n`id \"jesting-aside\"` on the seventh paragraph of the text. When we call\n`getElement \"jesting-aside\"` we would get the following information:\n\n\n\nThis can be useful for:\n\n - **Scrolling** — Pair this information with `setViewport` to scroll\n specific elements into view. This gives you a lot of control over where exactly\n the element would be after the viewport moved.\n\n - **Drag and Drop** — As of this writing, `touchmove` events do not tell\n you which element you are currently above. To figure out if you have dragged\n something over the target, you could see if the `pageX` and `pageY` of the\n touch are inside the `x`, `y`, `width`, and `height` of the target element.\n\n**Note:** This corresponds to JavaScript’s [`getBoundingClientRect`][gbcr],\nso **the element’s margins are included in its `width` and `height`**.\nWith scrolling, maybe you want to include the margins. With drag-and-drop, you\nprobably do not, so some folks set the margins to zero and put the target\nelement in a `<div>` that adds the spacing. Just something to be aware of!\n\n[gbcr]: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect\n\n","type":"String.String -> Task.Task Browser.Dom.Error Browser.Dom.Element"},{"name":"getViewport","comment":" Get information on the current viewport of the browser.\n\n\n\nIf you want to move the viewport around (i.e. change the scroll position) you\ncan use [`setViewport`](#setViewport) which change the `x` and `y` of the\nviewport.\n\n","type":"Task.Task x Browser.Dom.Viewport"},{"name":"getViewportOf","comment":" Just like `getViewport`, but for any scrollable DOM node. Say we have an\napplication with a chat box in the bottow right corner like this:\n\n\n\nThere are probably a whole bunch of messages that are not being shown. You\ncould scroll up to see them all. Well, we can think of that chat box is a\nviewport into a scene!\n\n\n\nThis can be useful with [`setViewportOf`](#setViewportOf) to make sure new\nmessages always appear on the bottom.\n\nThe viewport size _does not_ include the border or margins.\n\n**Note:** This data is collected from specific fields in JavaScript, so it\nmay be helpful to know that:\n\n - `scene.width` = [`scrollWidth`][sw]\n - `scene.height` = [`scrollHeight`][sh]\n - `viewport.x` = [`scrollLeft`][sl]\n - `viewport.y` = [`scrollTop`][st]\n - `viewport.width` = [`clientWidth`][cw]\n - `viewport.height` = [`clientHeight`][ch]\n\nNeither [`offsetWidth`][ow] nor [`offsetHeight`][oh] are available. The theory\nis that (1) the information can always be obtained by using `getElement` on a\nnode without margins, (2) no cases came to mind where you actually care in the\nfirst place, and (3) it is available through ports if it is really needed.\nIf you have a case that really needs it though, please share your specific\nscenario in an issue! Nicely presented case studies are the raw ingredients for\nAPI improvements!\n\n[sw]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth\n[sh]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight\n[st]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop\n[sl]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft\n[cw]: https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth\n[ch]: https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight\n[ow]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth\n[oh]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight\n\n","type":"String.String -> Task.Task Browser.Dom.Error Browser.Dom.Viewport"},{"name":"setViewport","comment":" Change the `x` and `y` offset of the browser viewport immediately. For\nexample, you could make a command to jump to the top of the page:\n\n import Browser.Dom as Dom\n import Task\n\n type Msg\n = NoOp\n\n resetViewport : Cmd Msg\n resetViewport =\n Task.perform (\\_ -> NoOp) (Dom.setViewport 0 0)\n\nThis sets the viewport offset to zero.\n\nThis could be useful with `Browser.application` where you may want to reset\nthe viewport when the URL changes. Maybe you go to a “new page”\nand want people to start at the top!\n\n","type":"Basics.Float -> Basics.Float -> Task.Task x ()"},{"name":"setViewportOf","comment":" Change the `x` and `y` offset of a DOM node’s viewport by ID. This\nis common in text messaging and chat rooms, where once the messages fill the\nscreen, you want to always be at the very bottom of the message chain. This\nway the latest message is always on screen! You could do this:\n\n import Browser.Dom as Dom\n import Task\n\n type Msg\n = NoOp\n\n jumpToBottom : String -> Cmd Msg\n jumpToBottom id =\n Dom.getViewportOf id\n |> Task.andThen (\\info -> Dom.setViewportOf id 0 info.scene.height)\n |> Task.attempt (\\_ -> NoOp)\n\nSo you could call `jumpToBottom \"chat-box\"` whenever you add a new message.\n\n**Note 1:** What happens if the viewport is placed out of bounds? Where there\nis no `scene` to show? To avoid this question, the `x` and `y` offsets are\nclamped such that the viewport is always fully within the `scene`. So when\n`jumpToBottom` sets the `y` offset of the viewport to the `height` of the\n`scene` (i.e. too far!) it relies on this clamping behavior to put the viewport\nback in bounds.\n\n**Note 2:** The example ignores when the element ID is not found, but it would\nbe great to log that information. It means there may be a bug or a dead link\nsomewhere!\n\n","type":"String.String -> Basics.Float -> Basics.Float -> Task.Task Browser.Dom.Error ()"}],"binops":[]},{"name":"Browser.Events","comment":" In JavaScript, information about the root of an HTML document is held in\nthe `document` and `window` objects. This module lets you create event\nlisteners on those objects for the following topics: [animation](#animation),\n[keyboard](#keyboard), [mouse](#mouse), and [window](#window).\n\nIf there is something else you need, use [ports] to do it in JavaScript!\n\n[ports]: https://guide.elm-lang.org/interop/ports.html\n\n\n# Animation\n\n@docs onAnimationFrame, onAnimationFrameDelta\n\n\n# Keyboard\n\n@docs onKeyPress, onKeyDown, onKeyUp\n\n\n# Mouse\n\n@docs onClick, onMouseMove, onMouseDown, onMouseUp\n\n\n# Window\n\n@docs onResize, onVisibilityChange, Visibility\n\n","unions":[{"name":"Visibility","comment":" Value describing whether the page is hidden or visible.\n","args":[],"cases":[["Visible",[]],["Hidden",[]]]}],"aliases":[],"values":[{"name":"onAnimationFrame","comment":" An animation frame triggers about 60 times per second. Get the POSIX time\non each frame. (See [`elm/time`](/packages/elm/time/latest) for more info on\nPOSIX times.)\n\n**Note:** Browsers have their own render loop, repainting things as fast as\npossible. If you want smooth animations in your application, it is helpful to\nsync up with the browsers natural refresh rate. This hooks into JavaScript's\n`requestAnimationFrame` function.\n\n","type":"(Time.Posix -> msg) -> Platform.Sub.Sub msg"},{"name":"onAnimationFrameDelta","comment":" Just like `onAnimationFrame`, except message is the time in milliseconds\nsince the previous frame. So you should get a sequence of values all around\n`1000 / 60` which is nice for stepping animations by a time delta.\n","type":"(Basics.Float -> msg) -> Platform.Sub.Sub msg"},{"name":"onClick","comment":" Subscribe to mouse clicks anywhere on screen. Maybe you need to create a\ncustom drop down. You could listen for clicks when it is open, letting you know\nif someone clicked out of it:\n\n import Browser.Events as Events\n import Json.Decode as D\n\n type Msg\n = ClickOut\n\n subscriptions : Model -> Sub Msg\n subscriptions model =\n case model.dropDown of\n Closed _ ->\n Sub.none\n\n Open _ ->\n Events.onClick (D.succeed ClickOut)\n\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onKeyDown","comment":" Subscribe to get codes whenever a key goes down. This can be useful for\ncreating games. Maybe you want to know if people are pressing `w`, `a`, `s`,\nor `d` at any given time.\n\n**Note:** Check out [this advice][note] to learn more about decoding key codes.\nIt is more complicated than it should be.\n\n[note]: https://github.com/elm/browser/blob/1.0.2/notes/keyboard.md\n\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onKeyPress","comment":" Subscribe to key presses that normally produce characters. So you should\nnot rely on this for arrow keys.\n\n**Note:** Check out [this advice][note] to learn more about decoding key codes.\nIt is more complicated than it should be.\n\n[note]: https://github.com/elm/browser/blob/1.0.2/notes/keyboard.md\n\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onKeyUp","comment":" Subscribe to get codes whenever a key goes up. Often used in combination\nwith [`onVisibilityChange`](#onVisibilityChange) to be sure keys do not appear\nto down and never come back up.\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onMouseDown","comment":" Subscribe to get mouse information whenever the mouse button goes down.\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onMouseMove","comment":" Subscribe to mouse moves anywhere on screen.\n\nYou could use this to implement resizable panels like in Elm's online code\neditor. Check out the example imprementation [here][drag].\n\n[drag]: https://github.com/elm/browser/blob/1.0.2/examples/src/Drag.elm\n\n**Note:** Unsubscribe if you do not need these events! Running code on every\nsingle mouse movement can be very costly, and it is recommended to only\nsubscribe when absolutely necessary.\n\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onMouseUp","comment":" Subscribe to get mouse information whenever the mouse button goes up.\nOften used in combination with [`onVisibilityChange`](#onVisibilityChange)\nto be sure keys do not appear to down and never come back up.\n","type":"Json.Decode.Decoder msg -> Platform.Sub.Sub msg"},{"name":"onResize","comment":" Subscribe to any changes in window size.\n\nFor example, you could track the current width by saying:\n\n import Browser.Events as E\n\n type Msg\n = GotNewWidth Int\n\n subscriptions : model -> Cmd Msg\n subscriptions _ =\n E.onResize (\\w h -> GotNewWidth w)\n\n**Note:** This is equivalent to getting events from [`window.onresize`][resize].\n\n[resize]: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onresize\n\n","type":"(Basics.Int -> Basics.Int -> msg) -> Platform.Sub.Sub msg"},{"name":"onVisibilityChange","comment":" Subscribe to any visibility changes, like if the user switches to a\ndifferent tab or window. When the user looks away, you may want to:\n\n- Pause a timer.\n- Pause an animation.\n- Pause video or audio.\n- Pause an image carousel.\n- Stop polling a server for new information.\n- Stop waiting for an [`onKeyUp`](#onKeyUp) event.\n\n","type":"(Browser.Events.Visibility -> msg) -> Platform.Sub.Sub msg"}],"binops":[]},{"name":"Browser.Navigation","comment":" This module helps you manage the browser’s URL yourself. This is the\ncrucial trick when using [`Browser.application`](Browser#application).\n\nThe most important function is [`pushUrl`](#pushUrl) which changes the\naddress bar _without_ starting a page load.\n\n\n## What is a page load?\n\n1. Request a new HTML document. The page goes blank.\n2. As the HTML loads, request any `<script>` or `<link>` resources.\n3. A `<script>` may mutate the document, so these tags block rendering.\n4. When _all_ of the assets are loaded, actually render the page.\n\nThat means the page will go blank for at least two round-trips to the servers!\nYou may have 90% of the data you need and be blocked on a font that is taking\na long time. Still blank!\n\n\n## How does `pushUrl` help?\n\nThe `pushUrl` function changes the URL, but lets you keep the current HTML.\nThis means the page _never_ goes blank. Instead of making two round-trips to\nthe server, you load whatever assets you want from within Elm. Maybe you do\nnot need any round-trips! Meanwhile, you retain full control over the UI, so\nyou can show a loading bar, show information as it loads, etc. Whatever you\nwant!\n\n\n# Navigate within Page\n\n@docs Key, pushUrl, replaceUrl, back, forward\n\n\n# Navigate to other Pages\n\n@docs load, reload, reloadAndSkipCache\n\n","unions":[{"name":"Key","comment":" A navigation `Key` is needed to create navigation commands that change the\nURL. That includes [`pushUrl`](#pushUrl), [`replaceUrl`](#replaceUrl),\n[`back`](#back), and [`forward`](#forward).\n\nYou only get access to a `Key` when you create your program with\n[`Browser.application`](Browser#application), guaranteeing that your program is\nequipped to detect these URL changes. If `Key` values were available in other\nkinds of programs, unsuspecting programmers would be sure to run into some\n[annoying bugs][bugs] and learn a bunch of techniques the hard way!\n\n[bugs]: https://github.com/elm/browser/blob/1.0.2/notes/navigation-in-elements.md\n\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"back","comment":" Go back some number of pages. So `back 1` goes back one page, and `back 2`\ngoes back two pages.\n\n**Note:** You only manage the browser history that _you_ created. Think of this\nlibrary as letting you have access to a small part of the overall history. So\nif you go back farther than the history you own, you will just go back to some\nother website!\n\n","type":"Browser.Navigation.Key -> Basics.Int -> Platform.Cmd.Cmd msg"},{"name":"forward","comment":" Go forward some number of pages. So `forward 1` goes forward one page, and\n`forward 2` goes forward two pages. If there are no more pages in the future,\nthis will do nothing.\n\n**Note:** You only manage the browser history that _you_ created. Think of this\nlibrary as letting you have access to a small part of the overall history. So\nif you go forward farther than the history you own, the user will end up on\nwhatever website they visited next!\n\n","type":"Browser.Navigation.Key -> Basics.Int -> Platform.Cmd.Cmd msg"},{"name":"load","comment":" Leave the current page and load the given URL. **This always results in a\npage load**, even if the provided URL is the same as the current one.\n\n gotoElmWebsite : Cmd msg\n gotoElmWebsite =\n load \"https://elm-lang.org\"\n\nCheck out the [`elm/url`][url] package for help building URLs. The\n[`Url.absolute`][abs] and [`Url.relative`][rel] functions can be particularly\nhandy!\n\n[url]: /packages/elm/url/latest\n[abs]: /packages/elm/url/latest/Url#absolute\n[rel]: /packages/elm/url/latest/Url#relative\n\n","type":"String.String -> Platform.Cmd.Cmd msg"},{"name":"pushUrl","comment":" Change the URL, but do not trigger a page load.\n\nThis will add a new entry to the browser history.\n\nCheck out the [`elm/url`][url] package for help building URLs. The\n[`Url.Builder.absolute`][abs] and [`Url.Builder.relative`][rel] functions can\nbe particularly handy!\n\n[url]: /packages/elm/url/latest\n[abs]: /packages/elm/url/latest/Url-Builder#absolute\n[rel]: /packages/elm/url/latest/Url-Builder#relative\n\n**Note:** If the user has gone `back` a few pages, there will be “future\npages” that the user can go `forward` to. Adding a new URL in that\nscenario will clear out any future pages. It is like going back in time and\nmaking a different choice.\n\n","type":"Browser.Navigation.Key -> String.String -> Platform.Cmd.Cmd msg"},{"name":"reload","comment":" Reload the current page. **This always results in a page load!**\nThis may grab resources from the browser cache, so use\n[`reloadAndSkipCache`](#reloadAndSkipCache)\nif you want to be sure that you are not loading any cached resources.\n","type":"Platform.Cmd.Cmd msg"},{"name":"reloadAndSkipCache","comment":" Reload the current page without using the browser cache. **This always\nresults in a page load!** It is more common to want [`reload`](#reload).\n","type":"Platform.Cmd.Cmd msg"},{"name":"replaceUrl","comment":" Change the URL, but do not trigger a page load.\n\nThis _will not_ add a new entry to the browser history.\n\nThis can be useful if you have search box and you want the `?search=hats` in\nthe URL to match without adding a history entry for every single key stroke.\nImagine how annoying it would be to click `back` thirty times and still be on\nthe same page!\n\n**Note:** Browsers may rate-limit this function by throwing an exception. The\ndiscussion [here](https://bugs.webkit.org/show_bug.cgi?id=156115) suggests\nthat the limit is 100 calls per 30 second interval in Safari in 2016. It also\nsuggests techniques for people changing the URL based on scroll position.\n\n","type":"Browser.Navigation.Key -> String.String -> Platform.Cmd.Cmd msg"}],"binops":[]}]
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2018-present, Evan Czaplicki
|
|
2
|
-
|
|
3
|
-
All rights reserved.
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
* Redistributions of source code must retain the above copyright
|
|
9
|
-
notice, this list of conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
* Redistributions in binary form must reproduce the above
|
|
12
|
-
copyright notice, this list of conditions and the following
|
|
13
|
-
disclaimer in the documentation and/or other materials provided
|
|
14
|
-
with the distribution.
|
|
15
|
-
|
|
16
|
-
* Neither the name of Evan Czaplicki nor the names of other
|
|
17
|
-
contributors may be used to endorse or promote products derived
|
|
18
|
-
from this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
21
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
22
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
23
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
24
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
25
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
26
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
27
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
28
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
29
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Bytes
|
|
2
|
-
|
|
3
|
-
Work with densely packed sequences of bytes.
|
|
4
|
-
|
|
5
|
-
The goal of this package is to support **network protocols** such as ProtoBuf. Or to put it another way, the goal is to have packages like `elm/http` send fewer bytes over the wire.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Motivation = [A vision for data interchange in Elm](https://gist.github.com/evancz/1c5f2cf34939336ecb79b97bb89d9da6)
|
|
9
|
-
|
|
10
|
-
Please read it!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Example
|
|
14
|
-
|
|
15
|
-
This package lets you create encoders and decoders for working with sequences of bytes. Here is an example for converting between `Point` and `Bytes` values:
|
|
16
|
-
|
|
17
|
-
```elm
|
|
18
|
-
import Bytes exposing (Endianness(..))
|
|
19
|
-
import Bytes.Encode as Encode exposing (Encoder)
|
|
20
|
-
import Bytes.Decode as Decode exposing (Decoder)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-- POINT
|
|
24
|
-
|
|
25
|
-
type alias Point =
|
|
26
|
-
{ x : Float
|
|
27
|
-
, y : Float
|
|
28
|
-
, z : Float
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
toPointEncoder : Point -> Encoder
|
|
32
|
-
toPointEncoder point =
|
|
33
|
-
Encode.sequence
|
|
34
|
-
[ Encode.float32 BE point.x
|
|
35
|
-
, Encode.float32 BE point.y
|
|
36
|
-
, Encode.float32 BE point.z
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
pointDecoder : Decoder Point
|
|
40
|
-
pointDecoder =
|
|
41
|
-
Decode.map3 Point
|
|
42
|
-
(Decode.float32 BE)
|
|
43
|
-
(Decode.float32 BE)
|
|
44
|
-
(Decode.float32 BE)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Rather than writing this by hand in client or server code, the hope is that folks implement things like ProtoBuf compilers for Elm.
|
|
48
|
-
|
|
49
|
-
Again, the overall plan is described in [**A vision for data interchange in Elm**](https://gist.github.com/evancz/1c5f2cf34939336ecb79b97bb89d9da6)!
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Scope
|
|
53
|
-
|
|
54
|
-
**This API is not intended to work like `Int8Array` or `Uint16Array` in JavaScript.** If you have a concrete scenario in which you want to interpret bytes as densely packed arrays of integers or floats, please describe it on [https://discourse.elm-lang.org/](https://discourse.elm-lang.org/) in a friendly and high-level way. What is the project about? What do densely packed arrays do for that project? Is it about perf? What kind of algorithms are you using? Etc.
|
|
55
|
-
|
|
56
|
-
If some scenarios require the mutation of entries in place, special care will be required in designing a nice API. All values in Elm are immutable, so the particular API that works well for us will probably depend a lot on the particulars of what folks are trying to do.
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Bytes","comment":"\n\n# Bytes\n@docs Bytes, width\n\n# Endianness\n@docs Endianness, getHostEndianness\n\n","unions":[{"name":"Bytes","comment":" A sequence of bytes.\n\nA byte is a chunk of eight bits. For example, the letter `j` is usually\nrepresented as the byte `01101010`, and the letter `k` is `01101011`.\n\nSeeing each byte as a stream of zeros and ones can be quite confusing though,\nso it is common to use hexidecimal numbers instead:\n\n```\n| Binary | Hex |\n+--------+-----+\n| 0000 | 0 |\n| 0001 | 1 |\n| 0010 | 2 |\n| 0011 | 3 | j = 01101010\n| 0100 | 4 | \\__/\\__/\n| 0101 | 5 | | |\n| 0110 | 6 | 6 A\n| 0111 | 7 |\n| 1000 | 8 | k = 01101011\n| 1001 | 9 | \\__/\\__/\n| 1010 | A | | |\n| 1011 | B | 6 B\n| 1100 | C |\n| 1101 | D |\n| 1110 | E |\n| 1111 | F |\n```\n\nSo `j` is `6A` and `k` is `6B` in hexidecimal. This more compact representation\nis great when you have a sequence of bytes. You can see this even in a short\nstring like `\"jazz\"`:\n\n```\nbinary hexidecimal\n01101010 01100001 01111010 01111010 => 6A 61 7A 7A\n```\n\nAnyway, the point is that `Bytes` is a sequence of bytes!\n","args":[],"cases":[]},{"name":"Endianness","comment":" Different computers store integers and floats slightly differently in\nmemory. Say we have the integer `0x1A2B3C4D` in our program. It needs four\nbytes (32 bits) in memory. It may seem reasonable to lay them out in order:\n\n```\n Big-Endian (BE) (Obvious Order)\n+----+----+----+----+\n| 1A | 2B | 3C | 4D |\n+----+----+----+----+\n```\n\nBut some people thought it would be better to store the bytes in the opposite\norder:\n\n```\n Little-Endian (LE) (Shuffled Order)\n+----+----+----+----+\n| 4D | 3C | 2B | 1A |\n+----+----+----+----+\n```\n\nNotice that **the _bytes_ are shuffled, not the bits.** It is like if you cut a\nphoto into four strips and shuffled the strips. It is not a mirror image.\nThe theory seems to be that an 8-bit `0x1A` and a 32-bit `0x0000001A` both have\n`1A` as the first byte in this scheme. Maybe this was helpful when processors\nhandled one byte at a time.\n\n**Most processors use little-endian (LE) layout.** This seems to be because\nIntel did it this way, and other chip manufactures followed their convention.\n**Most network protocols use big-endian (BE) layout.** I suspect this is\nbecause if you are trying to debug a network protocol, it is nice if your\nintegers are not all shuffled.\n\n**Note:** Endianness is relevant for integers and floats, but not strings.\nUTF-8 specifies the order of bytes explicitly.\n\n**Note:** The terms little-endian and big-endian are a reference to an egg joke\nin Gulliver's Travels. They first appeared in 1980 in [this essay][essay], and\nyou can decide for yourself if they stood the test of time. I personally find\nthese terms quite unhelpful, so I say “Obvious Order” and “Shuffled Order” in\nmy head. I remember which is more common by asking myself, “if things were\nobvious, would I have to ask this question?”\n\n[essay]: http://www.ietf.org/rfc/ien/ien137.txt\n","args":[],"cases":[["LE",[]],["BE",[]]]}],"aliases":[],"values":[{"name":"getHostEndianness","comment":" Is this program running on a big-endian or little-endian machine?\n","type":"Task.Task x Bytes.Endianness"},{"name":"width","comment":" Get the width of a sequence of bytes.\n\nSo if a sequence has four-hundred bytes, then `width bytes` would give back\n`400`. That may be 400 unsigned 8-bit integers, 100 signed 32-bit integers, or\neven a UTF-8 string. The content does not matter. This is just figuring out\nhow many bytes there are!\n","type":"Bytes.Bytes -> Basics.Int"}],"binops":[]},{"name":"Bytes.Decode","comment":"\n\n# Decoders\n@docs Decoder, decode\n\n# Integers\n@docs signedInt8, signedInt16, signedInt32,\n unsignedInt8, unsignedInt16, unsignedInt32\n\n# Floats\n@docs float32, float64\n\n# Bytes\n@docs bytes\n\n# Strings\n@docs string\n\n# Map\n@docs map, map2, map3, map4, map5\n\n# And Then\n@docs andThen, succeed, fail\n\n# Loop\n@docs Step, loop\n","unions":[{"name":"Decoder","comment":" Describes how to turn a sequence of bytes into a nice Elm value.\n","args":["a"],"cases":[]},{"name":"Step","comment":" Decide what steps to take next in your [`loop`](#loop).\n\nIf you are `Done`, you give the result of the whole `loop`. If you decide to\n`Loop` around again, you give a new state to work from. Maybe you need to add\nan item to a list? Or maybe you need to track some information about what you\njust saw?\n\n**Note:** It may be helpful to learn about [finite-state machines][fsm] to get\na broader intuition about using `state`. I.e. You may want to create a `type`\nthat describes four possible states, and then use `Loop` to transition between\nthem as you consume characters.\n\n[fsm]: https://en.wikipedia.org/wiki/Finite-state_machine\n","args":["state","a"],"cases":[["Loop",["state"]],["Done",["a"]]]}],"aliases":[],"values":[{"name":"andThen","comment":" Decode something **and then** use that information to decode something\nelse. This is most common with strings or sequences where you need to read\nhow long the value is going to be:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Decode as Decode\n\n string : Decoder String\n string =\n Decode.unsignedInt32 BE\n |> Decode.andThen Decode.string\n\nCheck out the docs for [`succeed`](#succeed), [`fail`](#fail), and\n[`loop`](#loop) to see `andThen` used in more ways!\n","type":"(a -> Bytes.Decode.Decoder b) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b"},{"name":"bytes","comment":" Copy a given number of bytes into a new `Bytes` sequence.\n","type":"Basics.Int -> Bytes.Decode.Decoder Bytes.Bytes"},{"name":"decode","comment":" Turn a sequence of bytes into a nice Elm value.\n\n -- decode (unsignedInt16 BE) <0007> == Just 7\n -- decode (unsignedInt16 LE) <0700> == Just 7\n -- decode (unsignedInt16 BE) <0700> == Just 1792\n -- decode (unsignedInt32 BE) <0700> == Nothing\n\nThe `Decoder` specifies exactly how this should happen. This process may fail\nif the sequence of bytes is corrupted or unexpected somehow. The examples above\nshow a case where there are not enough bytes.\n","type":"Bytes.Decode.Decoder a -> Bytes.Bytes -> Maybe.Maybe a"},{"name":"fail","comment":" A decoder that always fails. This can be useful when using `andThen` to\ndecode custom types:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Encode as Encode\n import Bytes.Decode as Decode\n\n type Distance = Yards Float | Meters Float\n\n toEncoder : Distance -> Encode.Encoder\n toEncoder distance =\n case distance of\n Yards n -> Encode.sequence [ Encode.unsignedInt8 0, Encode.float32 BE n ]\n Meters n -> Encode.sequence [ Encode.unsignedInt8 1, Encode.float32 BE n ]\n\n decoder : Decode.Decoder Distance\n decoder =\n Decode.unsignedInt8\n |> Decode.andThen pickDecoder\n\n pickDecoder : Int -> Decode.Decoder Distance\n pickDecoder tag =\n case tag of\n 0 -> Decode.map Yards (Decode.float32 BE)\n 1 -> Decode.map Meters (Decode.float32 BE)\n _ -> Decode.fail\n\nThe encoding chosen here uses an 8-bit unsigned integer to indicate which\nvariant we are working with. If we are working with yards do this, if we are\nworking with meters do that, and otherwise something went wrong!\n","type":"Bytes.Decode.Decoder a"},{"name":"float32","comment":" Decode four bytes into a floating point number.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Float"},{"name":"float64","comment":" Decode eight bytes into a floating point number.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Float"},{"name":"loop","comment":" A decoder that can loop indefinitely. This can be helpful when parsing\nrepeated structures, like a list:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Decode as Decode exposing (..)\n\n list : Decoder a -> Decoder (List a)\n list decoder =\n unsignedInt32 BE\n |> andThen (\\len -> loop (len, []) (listStep decoder))\n\n listStep : Decoder a -> (Int, List a) -> Decoder (Step (Int, List a) (List a))\n listStep decoder (n, xs) =\n if n <= 0 then\n succeed (Done xs)\n else\n map (\\x -> Loop (n - 1, x :: xs)) decoder\n\nThe `list` decoder first reads a 32-bit unsigned integer. That determines how\nmany items will be decoded. From there we use [`loop`](#loop) to track all the\nitems we have parsed so far and figure out when to stop.\n","type":"state -> (state -> Bytes.Decode.Decoder (Bytes.Decode.Step state a)) -> Bytes.Decode.Decoder a"},{"name":"map","comment":" Transform the value produced by a decoder. If you encode negative numbers\nin a special way, you can say something like this:\n\n negativeInt8 : Decoder Int\n negativeInt8 =\n map negate unsignedInt8\n\nIn practice you may see something like ProtoBuf’s [ZigZag encoding][zz] which\ndecreases the size of small negative numbers.\n\n[zz]: https://developers.google.com/protocol-buffers/docs/encoding#types\n","type":"(a -> b) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b"},{"name":"map2","comment":" Combine two decoders.\n\n import Bytes exposing (Endiannness(..))\n import Bytes.Decode as Decode\n\n type alias Point = { x : Float, y : Float }\n\n decoder : Decode.Decoder Point\n decoder =\n Decode.map2 Point\n (Decode.float32 BE)\n (Decode.float32 BE)\n","type":"(a -> b -> result) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b -> Bytes.Decode.Decoder result"},{"name":"map3","comment":" Combine three decoders.\n","type":"(a -> b -> c -> result) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b -> Bytes.Decode.Decoder c -> Bytes.Decode.Decoder result"},{"name":"map4","comment":" Combine four decoders.\n","type":"(a -> b -> c -> d -> result) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b -> Bytes.Decode.Decoder c -> Bytes.Decode.Decoder d -> Bytes.Decode.Decoder result"},{"name":"map5","comment":" Combine five decoders. If you need to combine more things, it is possible\nto define more of these with `map2` or `andThen`.\n","type":"(a -> b -> c -> d -> e -> result) -> Bytes.Decode.Decoder a -> Bytes.Decode.Decoder b -> Bytes.Decode.Decoder c -> Bytes.Decode.Decoder d -> Bytes.Decode.Decoder e -> Bytes.Decode.Decoder result"},{"name":"signedInt16","comment":" Decode two bytes into an integer from `-32768` to `32767`.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Int"},{"name":"signedInt32","comment":" Decode four bytes into an integer from `-2147483648` to `2147483647`.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Int"},{"name":"signedInt8","comment":" Decode one byte into an integer from `-128` to `127`.\n","type":"Bytes.Decode.Decoder Basics.Int"},{"name":"string","comment":" Decode a given number of UTF-8 bytes into a `String`.\n\nMost protocols store the width of the string right before the content, so you\nwill probably write things like this:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Decode as Decode\n\n sizedString : Decode.Decoder String\n sizedString =\n Decode.unsignedInt32 BE\n |> Decode.andThen Decode.string\n\nIn this case we read the width as a 32-bit unsigned integer, but you have the\nleeway to read the width as a [Base 128 Varint][pb] for ProtoBuf, a\n[Variable-Length Integer][sql] for SQLite, or whatever else they dream up.\n\n[pb]: https://developers.google.com/protocol-buffers/docs/encoding#varints\n[sql]: https://www.sqlite.org/src4/doc/trunk/www/varint.wiki\n","type":"Basics.Int -> Bytes.Decode.Decoder String.String"},{"name":"succeed","comment":" A decoder that always succeeds with a certain value. Maybe we are making\na `Maybe` decoder:\n\n import Bytes.Decode as Decode exposing (Decoder)\n\n maybe : Decoder a -> Decoder (Maybe a)\n maybe decoder =\n let\n helper n =\n if n == 0 then\n Decode.succeed Nothing\n else\n Decode.map Just decoder\n in\n Decode.unsignedInt8\n |> Decode.andThen helper\n\nIf the first byte is `00000000` then it is `Nothing`, otherwise we start\ndecoding the value and put it in a `Just`.\n","type":"a -> Bytes.Decode.Decoder a"},{"name":"unsignedInt16","comment":" Decode two bytes into an integer from `0` to `65535`.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Int"},{"name":"unsignedInt32","comment":" Decode four bytes into an integer from `0` to `4294967295`.\n","type":"Bytes.Endianness -> Bytes.Decode.Decoder Basics.Int"},{"name":"unsignedInt8","comment":" Decode one byte into an integer from `0` to `255`.\n","type":"Bytes.Decode.Decoder Basics.Int"}],"binops":[]},{"name":"Bytes.Encode","comment":"\n\n# Encoders\n@docs encode, Encoder, sequence\n\n# Integers\n@docs signedInt8, signedInt16, signedInt32,\n unsignedInt8, unsignedInt16, unsignedInt32\n\n# Floats\n@docs float32, float64\n\n# Bytes\n@docs bytes\n\n# Strings\n@docs string, getStringWidth\n\n","unions":[{"name":"Encoder","comment":" Describes how to generate a sequence of bytes.\n\nThese encoders snap together with [`sequence`](#sequence) so you can start with\nsmall building blocks and put them together into a more complex encoding.\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"bytes","comment":" Copy bytes directly into the new `Bytes` sequence. This does not record the\nwidth though! You usually want to say something like this:\n\n import Bytes exposing (Bytes, Endianness(..))\n import Bytes.Encode as Encode\n\n png : Bytes -> Encode.Encoder\n png imageData =\n Encode.sequence\n [ Encode.unsignedInt32 BE (Bytes.width imageData)\n , Encode.bytes imageData\n ]\n\nThis allows you to represent the width however is necessary for your protocol.\nFor example, you can use [Base 128 Varints][pb] for ProtoBuf,\n[Variable-Length Integers][sql] for SQLite, or whatever else they dream up.\n\n[pb]: https://developers.google.com/protocol-buffers/docs/encoding#varints\n[sql]: https://www.sqlite.org/src4/doc/trunk/www/varint.wiki\n","type":"Bytes.Bytes -> Bytes.Encode.Encoder"},{"name":"encode","comment":" Turn an `Encoder` into `Bytes`.\n\n encode (unsignedInt8 7) -- <07>\n encode (unsignedInt16 BE 7) -- <0007>\n encode (unsignedInt16 LE 7) -- <0700>\n\nThe `encode` function is designed to minimize allocation. It figures out the\nexact width necessary to fit everything in `Bytes` and then generate that\nvalue directly. This is valuable when you are encoding more elaborate data:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Encode as Encode\n\n type alias Person =\n { age : Int\n , name : String\n }\n\n toEncoder : Person -> Encode.Encoder\n toEncoder person =\n Encode.sequence\n [ Encode.unsignedInt16 BE person.age\n , Encode.unsignedInt16 BE (Encode.getStringWidth person.name)\n , Encode.string person.name\n ]\n\n -- encode (toEncoder (Person 33 \"Tom\")) == <00210003546F6D>\n\nDid you know it was going to be seven bytes? How about when you have a hundred\npeople to serialize? And when some have Japanese and Norwegian names? Having\nthis intermediate `Encoder` can help reduce allocation quite a lot!\n","type":"Bytes.Encode.Encoder -> Bytes.Bytes"},{"name":"float32","comment":" Encode 32-bit floating point numbers in four bytes.\n","type":"Bytes.Endianness -> Basics.Float -> Bytes.Encode.Encoder"},{"name":"float64","comment":" Encode 64-bit floating point numbers in eight bytes.\n","type":"Bytes.Endianness -> Basics.Float -> Bytes.Encode.Encoder"},{"name":"getStringWidth","comment":" Get the width of a `String` in UTF-8 bytes.\n\n getStringWidth \"$20\" == 3\n getStringWidth \"£20\" == 4\n getStringWidth \"€20\" == 5\n getStringWidth \"bread\" == 5\n getStringWidth \"brød\" == 5\n\nMost protocols need this number to come directly before a chunk of UTF-8 bytes\nas a way to know where the string ends!\n\nRead more about how UTF-8 works [here](https://en.wikipedia.org/wiki/UTF-8).\n","type":"String.String -> Basics.Int"},{"name":"sequence","comment":" Put together a bunch of builders. So if you wanted to encode three `Float`\nvalues for the position of a ball in 3D space, you could say:\n\n import Bytes exposing (Endianness(..))\n import Bytes.Encode as Encode\n\n type alias Ball = { x : Float, y : Float, z : Float }\n\n ball : Ball -> Encode.Encoder\n ball {x,y,z} =\n Encode.sequence\n [ Encode.float32 BE x\n , Encode.float32 BE y\n , Encode.float32 BE z\n ]\n\n","type":"List.List Bytes.Encode.Encoder -> Bytes.Encode.Encoder"},{"name":"signedInt16","comment":" Encode integers from `-32768` to `32767` in two bytes.\n","type":"Bytes.Endianness -> Basics.Int -> Bytes.Encode.Encoder"},{"name":"signedInt32","comment":" Encode integers from `-2147483648` to `2147483647` in four bytes.\n","type":"Bytes.Endianness -> Basics.Int -> Bytes.Encode.Encoder"},{"name":"signedInt8","comment":" Encode integers from `-128` to `127` in one byte.\n","type":"Basics.Int -> Bytes.Encode.Encoder"},{"name":"string","comment":" Encode a `String` as a bunch of UTF-8 bytes.\n\n encode (string \"$20\") -- <24 32 30>\n encode (string \"£20\") -- <C2A3 32 30>\n encode (string \"€20\") -- <E282AC 32 30>\n encode (string \"bread\") -- <62 72 65 61 64>\n encode (string \"brød\") -- <62 72 C3B8 64>\n\nSome characters take one byte, while others can take up to four. Read more\nabout [UTF-8](https://en.wikipedia.org/wiki/UTF-8) to learn the details!\n\nBut if you just encode UTF-8 directly, how can you know when you get to the end\nof the string when you are decoding? So most protocols have an integer saying\nhow many bytes follow, like this:\n\n sizedString : String -> Encoder\n sizedString str =\n sequence\n [ unsignedInt32 BE (getStringWidth str)\n , string str\n ]\n\nYou can choose whatever representation you want for the width, which is helpful\nbecause many protocols use different integer representations to save space. For\nexample:\n\n- ProtoBuf uses [Base 128 Varints](https://developers.google.com/protocol-buffers/docs/encoding#varints)\n- SQLite uses [Variable-Length Integers](https://www.sqlite.org/src4/doc/trunk/www/varint.wiki)\n\nIn both cases, small numbers can fit just one byte, saving some space. (The\nSQLite encoding has the benefit that the first byte tells you how long the\nnumber is, making it faster to decode.) In both cases, it is sort of tricky\nto make negative numbers small.\n","type":"String.String -> Bytes.Encode.Encoder"},{"name":"unsignedInt16","comment":" Encode integers from `0` to `65535` in two bytes.\n","type":"Bytes.Endianness -> Basics.Int -> Bytes.Encode.Encoder"},{"name":"unsignedInt32","comment":" Encode integers from `0` to `4294967295` in four bytes.\n","type":"Bytes.Endianness -> Basics.Int -> Bytes.Encode.Encoder"},{"name":"unsignedInt8","comment":" Encode integers from `0` to `255` in one byte.\n","type":"Basics.Int -> Bytes.Encode.Encoder"}],"binops":[]}]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Copyright 2014-present Evan Czaplicki
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|