Last active
January 6, 2020 20:48
-
-
Save davidchase/4b7e0e2f1159616979919dd1dd97c876 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 where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Data.Foldable (fold) | |
import TryPureScript (DOM, p, render, text) | |
data Maybe a = Just a | Nothing | |
map :: forall a b. (a -> b) -> Maybe a -> Maybe b | |
map f n = | |
case n of | |
Just n -> Just (f n) | |
Nothing -> Nothing | |
toString x = | |
case x of | |
Just x -> "Just(" <> show x <> ")" | |
Nothing -> "Nothing" | |
main :: Eff (dom :: DOM) Unit | |
main = | |
render $ fold | |
[ p (text $ toString $ Just 1), | |
p (text $ toString $ map(\x -> x * x) $ Just 10)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment