Skip to content

Instantly share code, notes, and snippets.

@prednaz
Last active December 20, 2021 20:24
Show Gist options
  • Save prednaz/8d96a7a893fec388feae5e8149348fd3 to your computer and use it in GitHub Desktop.
Save prednaz/8d96a7a893fec388feae5e8149348fd3 to your computer and use it in GitHub Desktop.
{-# language
GADTSyntax,
FlexibleInstances
#-}
import Prelude hiding (String)
import qualified Prelude
main :: IO ()
main = print sample
-- \f -> f (\FormalParameter -> Haar (Iets FormalParameter)) (\FormalParameter -> Willen (Laten (Zeggen FormalParameter)))
sample :: Tup
sample = want (let_ (say something) her)
type String = Star -> Star
type Tup = (String -> String -> Prelude.String) -> Prelude.String
her :: String
her = Haar
something :: String
something = Iets
say :: String -> Tup
say = \x f -> f x Zeggen
want :: Tup -> Tup
want = \q f -> q (\y z -> f y (Willen . z))
let_ :: Tup -> String -> Tup
let_ = \q x f -> q (\z w -> f (x . z) (Laten . w))
data Star where
Haar :: Star -> Star
Iets :: Star -> Star
Zeggen :: Star -> Star
Laten :: Star -> Star
Willen :: Star -> Star
FormalParameter :: Star
deriving Show
instance Show String where
show s = "\\FormalParameter -> " ++ show (s FormalParameter)
instance Show ((String -> String -> Prelude.String) -> Prelude.String) where
show tup =
tup
(\a b ->
"\\f -> f (" ++ show a ++ ") ("
++
show b ++ ")"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment