This file contains 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
-- This way gives you a custom type, which can be used to branch on in code with case of. | |
type Pet | |
= Cat | |
| Dog | |
| Snake | |
| Spider | |
petEnum = |
This file contains 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 BasicSyntax exposing (..) | |
fact : Int -> Int | |
fact n = | |
if n == 0 then | |
1 | |
else | |
n * fact (n - 1) | |
map : (a -> b) -> List a -> List b |
This file contains 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 Tree | |
exposing | |
( Tree | |
, Zipper | |
, Path | |
-- Tree operations | |
, singleton | |
, zipper | |
, map | |
-- Zipper operations |
This file contains 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 Traits exposing (..) | |
type GameState | |
= State | |
{-| FireTrait defines how the game state is updated for any kind of shooting | |
event. | |
's' is the state implementation parameter, |
This file contains 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 ProgramCombinator exposing (..) | |
import Html exposing (Html) | |
import Time exposing (Time, every, second) | |
-- Example | |
type alias Model = |
This file contains 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 Channels exposing (..) | |
import Html exposing (Html) | |
import Time exposing (Time, every, second) | |
-- Example | |
type alias Model = |
This file contains 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 GameState | |
exposing | |
( Game(..) | |
, GameDefinition | |
, PlayState | |
, loading | |
, updateGameDefinition | |
, updatePlayState | |
, updateScore | |
, toReady |
This file contains 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 StateModel | |
exposing | |
( boolToMaybe | |
, (>&&>) | |
, (>||>) | |
, defaultTransition | |
, mapWhenCompose | |
) | |
import Maybe exposing (andThen) |
NewerOlder