git.iko.soy/rowtype-yoga/purs-eval
on main help sign in
22 lines 668 B history raw
1module Main (main) where
3import Prelude (Unit, bind, discard)
4import Effect (Effect)
5import Effect.Aff (launchAff_)
6import Node.Process (stdin, stdout)
7import Node.Stream.Aff (readSome, write, end, toStringUTF8, fromStringUTF8)
8import Compiler (successFromJson, runCompiler)
10main :: Effect Unit
11main = launchAff_ do
12 { buffers } <- readSome stdin
13 code <- toStringUTF8 buffers
14 let settings = { protocol: "https"
15 , hostname: "compile.purescript.org"
16 , port: 443
17 , parser: successFromJson
18 }
19 code' <- runCompiler settings code
20 output <- fromStringUTF8 code'
21 write stdout output
22 end stdout