Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Created August 9, 2015 00:36
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 davidgrenier/edd0e0ddc94172901191 to your computer and use it in GitHub Desktop.
Save davidgrenier/edd0e0ddc94172901191 to your computer and use it in GitHub Desktop.
type Meta = interface end
type U<'ty>() =
class
interface Meta
end
type K<'ty, 'x>(elem: 'x) =
interface Meta
member x.Elem = elem
type Id<'ty>(elem: 'ty) =
interface Meta
member x.Elem = elem
type Sum<'ty,'a,'b when 'a :> Meta and 'b :> Meta>(elem: Choice<'a,'b>) =
interface Meta
member x.Elem = elem
type Prod<'ty, 'a, 'b when 'a :> Meta and 'b :> Meta>(e1: 'a, e2: 'b) =
interface Meta
member x.Elem = e1, e2
member x.E1 = e1
member x.E2 = e2
type Elems =
| Cons of int * Elems
| Val of int
| Nil
type ElemsRep =
Sum<Elems,
Sum<Elems,
Prod<Elems, K<Elems, int>, Id<Elems>>,
K<Elems, int>>,
U<Elems>>
@davidgrenier
Copy link
Author

Perhaps this is what was intended

type ElemsRep =
    Sum<Elems,
        Sum<Elems,
            Prod<Elems, K<Elems, int>, Prod<Elems, Id<Elems>, U<Elems>>>,
            Sum<Elems,
                Prod<Elems, K<Elems, int>, U<Elems>>,
                U<Elems>>>,
        U<Elems>>

@davidgrenier
Copy link
Author

Or this:

type ElemsRep =
    Prod<Elems,
            Sum<Elems,
                Prod<Elems, K<Elems, int>, Prod<Elems, Id<Elems>, U<Elems>>>,
                Sum<Elems,
                    Prod<Elems, K<Elems, int>, U<Elems>>,
                    U<Elems>>>,
            U<Elems>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment