Created
July 18, 2018 12:10
-
-
Save lucamug/d24b18d99686d194373fec83e0b17cf7 to your computer and use it in GitHub Desktop.
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 Main exposing (main) | |
import Element exposing (..) | |
import Html exposing (Html) | |
foo = | |
(+) 3 << (+) 2 | |
applicative maybeValue maybeCallback = | |
case maybeCallback of | |
Just callback -> | |
case maybeValue of | |
Just value -> | |
Just (callback value) | |
Nothing -> | |
Nothing | |
Nothing -> | |
Nothing | |
applicative_v2 = | |
Maybe.map2 (|>) | |
main : Html msg | |
main = | |
layout [ padding 10 ] <| | |
column [ spacing 10 ] | |
[ text "> Maybe.map ((+)3) (Just 2)" | |
, text <| toString <| Maybe.map ((+) 3) (Just 2) | |
, text "> Maybe.map ((+)3) Nothing" | |
, text <| toString <| Maybe.map ((+) 3) Nothing | |
, text "> foo = (+)3 << (+)2" | |
, text "> foo 10" | |
, text <| toString <| foo 10 | |
, text "> applicative maybeValue maybeCallback = \\" | |
, text " case maybeCallback of \\" | |
, text " Just callback -> case maybeValue of \\" | |
, text " Just value -> Just (callback value) \\" | |
, text " Nothing -> Nothing \\" | |
, text " Nothing -> Nothing" | |
, text "> Just ((+)3) |> applicative (Just 2)" | |
, text <| toString <| (Just ((+) 3) |> applicative (Just 2)) | |
, text "> applicative_v2 = Maybe.map2 (|>)" | |
, text "> Just ((+)3) |> applicative_v2 (Just 2)" | |
, text <| toString <| (Just ((+) 3) |> applicative_v2 (Just 2)) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment