Skip to content

Instantly share code, notes, and snippets.

@leque
Created November 17, 2019 02:38
Show Gist options
  • Save leque/2c716b25e791dd84b04b990ad9044dd3 to your computer and use it in GitHub Desktop.
Save leque/2c716b25e791dd84b04b990ad9044dd3 to your computer and use it in GitHub Desktop.
Require Extraction.
Inductive list (A : Type) : Type :=
| nil : list A
| cons : A -> list A -> list A.
CoInductive Stream (A : Type) :=
Cons : A -> Stream A -> Stream A.
Extraction Language Haskell.
Extraction list.
Extraction Stream.
(* ->
data List a =
Nil
| Cons a (List a)
data Stream a =
Cons a (Stream a)
*)
Extraction Language OCaml.
Extraction list.
Extraction Stream.
(* ->
type 'a list =
| Nil
| Cons of 'a * 'a list
type 'a stream = 'a __stream Lazy.t
and 'a __stream =
| Cons of 'a * 'a stream
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment