Skip to content

Instantly share code, notes, and snippets.

@aratama
Created April 24, 2017 04:42
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 aratama/1b3b9a2c1672f4ecfdf4183820cef28e to your computer and use it in GitHub Desktop.
Save aratama/1b3b9a2c1672f4ecfdf4183820cef28e to your computer and use it in GitHub Desktop.
purescript-hyper example with do notation
module Main where
import Control.IxMonad (ibind, (:>>=))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE)
import Data.MediaType.Common (textPlain)
import Hyper.Node.Server (defaultOptionsWithLogging, runServer)
import Hyper.Response (closeHeaders, contentType, end, send, toResponse, writeStatus)
import Hyper.Status (statusOK)
import Node.HTTP (HTTP)
import Prelude (Unit)
main :: forall e. Eff (console :: CONSOLE, http :: HTTP | e) Unit
main = runServer defaultOptionsWithLogging {} do
writeStatus statusOK
contentType textPlain
closeHeaders
toResponse "Hello, Hyper!" :>>= send
end
bind = ibind
discard = ibind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment