Skip to content

Instantly share code, notes, and snippets.

@Nitive
Created November 30, 2017 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nitive/64584fad5b5fe39a07ac05bf227e14bd to your computer and use it in GitHub Desktop.
Save Nitive/64584fad5b5fe39a07ac05bf227e14bd to your computer and use it in GitHub Desktop.
module Main
console.log : Show a => a -> IO ()
console.log = printLn
createComponent : Show a => String -> a -> String
createComponent tag content = "<" ++ tag ++ ">" ++ show content ++ "</" ++ tag ++ ">"
syntax [arr] ".map" [f] = map f arr
syntax [arr] ".forEach" [f] = traverse f arr
syntax {arg} "=>" [body] = \arg => body
term syntax "<div>{" [content] "}</div>" = createComponent "div" content
main : IO ()
main = do
let arr = [1,2,3]
let double = x => x * 2;
((arr
.map(double))
.map(double))
.forEach(x => console.log(<div>{x}</div>))
pure ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment