- This doc - https://gist.github.com/paf31/80fdea566b0f7cfefadd
- About me
- About you
- About PureScript
- Features
- Type Inference
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 Parsing | |
import Either | |
foreign import data JSON :: * | |
foreign import toJSON "function toJSON (obj) { return obj; }" :: forall a. a -> JSON | |
foreign import showJSON "function showJSON (obj) { return JSON.stringify(obj); }" :: JSON -> String |
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
var main = function __do() { | |
var _4 = 1; | |
var _3 = 1; | |
return (function () { | |
while (_ps.Prelude.pure(_ps.Prelude.applicativeFromMonad(_ps.Control_Monad_Eff.monadEff({})))(true)()) { | |
(function __do() { | |
var _2 = _4; | |
var _1 = _3; | |
_3 = _2 + _1; | |
_4 = _1; |
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 Debug.Trace | |
data Trampoline a = Done a | More ({} -> Trampoline a) | |
instance functorTrampoline :: Functor Trampoline where | |
(<$>) f (Done a) = Done (f a) | |
(<$>) f (More k) = More $ \_ -> f <$> k {} | |
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 | |
foreign import data Exists :: (* -> *) -> * | |
foreign import mkExists | |
"function mkExists(fa) {\ | |
\ return fa;\ | |
\}" :: forall f a. f a -> Exists f | |
foreign import runExists |
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 LLC | |
consume : Nat -> List (Maybe Nat) -> List (Maybe Nat) | |
consume vid (Nothing :: vs) = Nothing :: consume vid vs | |
consume vid (Just v :: vs) with (vid == v) | |
| True = Nothing :: vs | |
| False = Just v :: consume vid vs | |
data Lolli : Type -> Type -> Type where | |
mkLolli : (a -> b) -> Lolli a b |
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 qualified Language.PureScript as P | |
main = interact compile | |
where | |
compile text = | |
case P.runIndentParser "" P.parseModules "module Prelude where\nmain = \"Hello World\"" of | |
Left err -> show err | |
Right modules -> |
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
let isEven :: Number -> Boolean | |
isEven 0 = false | |
isEven 1 = false | |
isEven 2 = true | |
isEven n = isEven(n-1) |
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 Data.Maybe (fromMaybe) | |
import Control.Monad (liftM, liftM2) | |
data Term | |
= TmVar Int | |
| TmSkolem Int Int Int | |
| TmPair Term Term |
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
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} | |
module Main where | |
import Test.QuickCheck | |
class Arbiter f r where | |
arbiter :: f -> Gen r | |
instance Arbiter r r where |
OlderNewer