Move stuff around + add lean and idris experiments
This commit is contained in:
parent
a45a4e94b3
commit
ca3f83d186
122 changed files with 1959 additions and 2 deletions
purescript/compose/src
44
purescript/compose/src/Main.purs
Normal file
44
purescript/compose/src/Main.purs
Normal file
|
@ -0,0 +1,44 @@
|
|||
module Main where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Compose as Compose
|
||||
import Data.Exists (Exists)
|
||||
import Effect (Effect)
|
||||
import Effect.Class.Console (logShow)
|
||||
import Unsafe.Coerce (unsafeCoerce)
|
||||
|
||||
|
||||
c :: Int -> Int
|
||||
c = Compose.do
|
||||
add2
|
||||
double
|
||||
|
||||
add2 :: Int -> Int
|
||||
add2 = (+) 2
|
||||
|
||||
double :: Int -> Int
|
||||
double = (*) 2
|
||||
|
||||
newtype I a = I a
|
||||
type EI = Exists I
|
||||
|
||||
type Showable f = forall result. (forall r. Show r => f r -> result) -> result
|
||||
|
||||
mkShowable :: forall a f. Show a => f a -> Showable f
|
||||
mkShowable a f = f a
|
||||
|
||||
test :: String
|
||||
test = do
|
||||
I something <- mkShowable $ I 0
|
||||
show something
|
||||
where
|
||||
bind :: forall f result. Showable f -> (forall r. Show r => f r -> result) -> result
|
||||
bind e f = e f
|
||||
|
||||
magicShow :: forall r. r -> String
|
||||
magicShow = unsafeCoerce
|
||||
|
||||
main :: Effect Unit
|
||||
main = do
|
||||
logShow $ c 3
|
Loading…
Add table
Add a link
Reference in a new issue