Created
April 24, 2017 04:42
-
-
Save aratama/1b3b9a2c1672f4ecfdf4183820cef28e to your computer and use it in GitHub Desktop.
purescript-hyper example with do notation
This file contains hidden or 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 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