Skip to content

Instantly share code, notes, and snippets.

@leighman
Created February 26, 2019 21:50
Show Gist options
  • Save leighman/a0a599f592914893687a936797b178b3 to your computer and use it in GitHub Desktop.
Save leighman/a0a599f592914893687a936797b178b3 to your computer and use it in GitHub Desktop.
module Main where
import Prelude
import Control.Monad.Eff.Console (logShow)
import Data.Maybe (Maybe(..))
import Data.Either (Either(..))
import TryPureScript
main = render =<< withConsole do
logShow $ [1, 2, 3] <#> add1
logShow $ [Just 1, Just 2, Nothing] <#> map add1
logShow $ [[1, 2], [3], []] <#> map add1
logShow $ [Right 1, Right 2, Left "error"] <#> map add1
logShow $ explainMe
add1 = (+) 1
times2 = (*) 2
explainMe = [add1, times2] <#> map add1 <#> \f -> f 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment