Skip to content

Instantly share code, notes, and snippets.

@Profpatsch
Created August 14, 2018 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Profpatsch/f9cd34513317cb2cb203a179d45e8b5d to your computer and use it in GitHub Desktop.
Save Profpatsch/f9cd34513317cb2cb203a179d45e8b5d to your computer and use it in GitHub Desktop.
dhall & dada s-expressions
let id = ./dada/id
in let SexprF = λ(f : Type) → < Str : Text | Int : Integer | Sexpr : List f >
in let SexprC = λ(f : Type) → constructors (SexprF f)
in let map =
λ(a : Type)
→ λ(b : Type)
→ λ(fn : a → b)
→ λ(sexp : SexprF a)
→ merge
{ Str =
(SexprC b).Str
, Int =
(SexprC b).Int
, Sexpr =
λ(xs : List a)
→ (SexprC b).Sexpr (./prelude/List/map a b fn xs)
}
sexp
: SexprF b
in ./dada/Mu/recursive SexprF { map = map }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment