#
##
#
#
##
#
#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Json.Decoder as Json | |
| import Html.Events exposing (keyCode | |
| onEnter : Msg -> Attribute Msg | |
| onEnter msg = | |
| let | |
| isEnterAndShift : CodeAndShift -> Decoder msg | |
| isEnterAndShift {code, shift = | |
| if code == 13 && not shift then | |
| Json.succeed msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| update = | |
| -- .. | |
| let | |
| -- Maybe buildNewMessage and appendNewMessage could live outside this let statement? | |
| -- If not, try giving them a type signature, that helpers outsiders | |
| -- like me understand what this is | |
| buildNewMessage u = | |
| let source = | |
| if u == user | |
| then Self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| customOnChange : ((Int, String) -> Msg) -> Attribute Msg | |
| customOnChange handler = | |
| let | |
| toTuple = | |
| Json.map2 (,) keyCode targetValue | |
| in | |
| on "input" (Json.map handler toTuple) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapGrid : (Int -> Int -> Data -> Data) -> Array (Array Data) -> Array (Array Data) | |
| mapGrid f grid = | |
| Array.indexedMap (mapRow f) grid | |
| mapRow : (Int -> Int -> Data -> Data) -> Int -> Array Data -> Array Data | |
| mapRow f rowIndex row = | |
| Array.indexedMap (mapDatum (f rowIndex)) row | |
| mapDatum : (Int -> Data -> Data) -> Int -> Data -> Data | |
| mapDatum f colIndex = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module InfiniteArray exposing ( get ) | |
| import Array | |
| get : Int -> Array a -> Maybe a | |
| get index array = | |
| if Array.isEmpty array then | |
| Nothing | |
| else |
PRs are welcome. You can expect a response within 5 days.
If you are adding a new function please..
0 Include documentation and make sure it has a code snippet demonstrating what the function does.
1 Give a detailed use case where your function would come in handy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Msg | |
| = UpdatePin PinMsg | |
| | SomethingElse | |
| type PinMsg | |
| = This | |
| | That | |
| | OtherThing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Time exposing (Time) | |
| type alias Model = | |
| { step : Int | |
| , bpm : Float | |
| , notes : List Float | |
| , playing : Bool | |
| } | |
| type Msg |