Skip to content

Instantly share code, notes, and snippets.

@joneshf
joneshf / Main.purs
Created August 6, 2018 14:37
Crosswalk
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, logShow)
import Data.Foldable (class Foldable)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.List (List(Nil, Cons), range)
module Main where
import Prelude
import Control.Monad.Eff.Console (logShow)
import Data.Bifunctor (lmap)
import Data.Maybe (Maybe(Just, Nothing))
import Data.Tuple (Tuple(Tuple))
import Data.Unfoldable (class Unfoldable, unfoldr)
import TryPureScript (render, withConsole)
@joneshf
joneshf / Main.purs
Created May 14, 2018 06:54
mkFnN optimization
module Main where
import Prelude
import Data.Function.Uncurried (mkFn1)
foo = mkFn1 \_ -> 4
bar = mkFn1 $ const 4
@joneshf
joneshf / Main.purs
Created May 12, 2018 19:15
Won't type check
module Main where
import Prelude
data NoArguments a =
NoArguments
instance functorNoArguments :: Functor NoArguments where
map _ a = a
module Main where
import Prelude
import Unsafe.Coerce
data FOO
data BAR
data BAZ
data Run (x :: # Type) a
module Main where
import Prelude
import Data.Foldable (class Foldable, foldl)
import Data.Maybe (Maybe(Just, Nothing))
data NonEmpty a = NonEmpty a (Array a)
instance foldableNonEmpty :: Foldable NonEmpty where
@joneshf
joneshf / Main.purs
Created April 27, 2018 12:34
More rowness
module Main where
foo :: forall r. ( | r) -> r
foo x = x
bar :: ( | Int)
bar = 1
@joneshf
joneshf / Main.purs
Created April 27, 2018 12:28
Open row
module Main where
foo :: forall r. ( | r) -> r
foo x = x
@joneshf
joneshf / Main.purs
Created April 21, 2018 17:27
codata
module Main where
import Prelude
class Codata --where
data Stream a
= Head a (Codata => Stream a)
from :: Int -> Stream Int
module Main where
import Prelude
import Control.Monad.Eff
import Control.Monad.Eff.Unsafe
import Data.Function.Uncurried
import Unsafe.Coerce
import Control.Monad.Eff.Console as Console