Skip to content

Commit 8d9adc6

Browse files
author
Ian Kariniemi
committed
WIP on Polymorphic Task.
1 parent d8d88d9 commit 8d9adc6

File tree

12 files changed

+663
-160
lines changed

12 files changed

+663
-160
lines changed

examples/build-systems-ala-carte/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ HS_SPEC=hs-spec
2020

2121
# Handwritten modules (usually by modification of generated version)
2222
HANDMOD = \
23+
Build/Task \
2324

2425

2526

@@ -67,7 +68,6 @@ HANDMOD = \
6768
# | Script : k -> Key k v s s
6869
# | Value : k -> Key k v s v.
6970
MODULES = \
70-
Build/Task \
7171
Build/Store \
7272
Build/Trace \
7373
Build/Task/Monad \
-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
skip Build.Task.compose
2-
3-
4-
# TODO: Handwrite these
5-
skip Build.Task.liftTask
6-
skip Build.Task.liftTasks
71

82
rename type GHC.Integer.Type.Integer = GHC.Num.Integer

examples/build-systems-ala-carte/lib/Build/Store.v

+14-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Unset Printing Implicit Defensive.
1010
Require Coq.Program.Tactics.
1111
Require Coq.Program.Wf.
1212

13+
(* Preamble *)
14+
15+
Require Import HsToCoq.Unpeel.
16+
Require Import Coq.ZArith.ZArith.
17+
1318
(* Converted imports: *)
1419

1520
Require GHC.Base.
@@ -46,6 +51,12 @@ Definition values {i} {k} {v} (arg_0__ : Store i k v) :=
4651
let 'Mk_Store _ values := arg_0__ in
4752
values.
4853

54+
(* Midamble *)
55+
56+
Instance Unpeel__Hash {A : Type} : Unpeel (Hash A) A :=
57+
{| unpeel := fun hashA : Hash A => match hashA with | Mk_Hash a => a end;
58+
repeel := Mk_Hash |}.
59+
4960
(* Converted value declarations: *)
5061

5162
Local Definition Eq___Hash_op_zeze__ {inst_a : Type} `{GHC.Base.Eq_ inst_a}
@@ -161,10 +172,10 @@ Program Instance Hashable__Int : Hashable GHC.Num.Int :=
161172
fun _ k__ => k__ {| hash__ := Hashable__Int_hash |}.
162173

163174
Local Definition Hashable__Integer_hash
164-
: GHC.Integer.Type.Integer -> Hash GHC.Integer.Type.Integer :=
175+
: GHC.Num.Integer -> Hash GHC.Num.Integer :=
165176
Mk_Hash.
166177

167-
Program Instance Hashable__Integer : Hashable GHC.Integer.Type.Integer :=
178+
Program Instance Hashable__Integer : Hashable GHC.Num.Integer :=
168179
fun _ k__ => k__ {| hash__ := Hashable__Integer_hash |}.
169180

170181
Local Definition Hashable__list_hash {inst_a : Type} `{Hashable inst_a}
@@ -234,6 +245,5 @@ Definition initialise {i : Type} {k : Type} {v : Type}
234245
GHC.Base.op_zgze__ GHC.Base.op_zgze____ GHC.Base.op_zl__ GHC.Base.op_zl____
235246
GHC.Base.op_zlzd__ GHC.Base.op_zlzd____ GHC.Base.op_zlze__ GHC.Base.op_zlze____
236247
GHC.Base.op_zlztzg____ GHC.Base.op_zsze__ GHC.Base.op_zsze____
237-
GHC.Base.op_ztzg____ GHC.Base.pure__ GHC.Integer.Type.Integer GHC.Num.Int
238-
GHC.Prim.coerce
248+
GHC.Base.op_ztzg____ GHC.Base.pure__ GHC.Num.Int GHC.Num.Integer GHC.Prim.coerce
239249
*)

examples/build-systems-ala-carte/lib/Build/Task.v

-40
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../manual/Build/Task.v
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
(* Default settings (from HsToCoq.Coq.Preamble) *)
2+
3+
Generalizable All Variables.
4+
5+
Unset Implicit Arguments.
6+
Set Maximal Implicit Insertion.
7+
Unset Strict Implicit.
8+
Unset Printing Implicit Defensive.
9+
10+
Require Coq.Program.Tactics.
11+
Require Coq.Program.Wf.
12+
13+
(* Converted imports: *)
14+
15+
Require Build.Store.
16+
Require Build.Task.
17+
Require Data.Either.
18+
Require Data.Maybe.
19+
Require GHC.Base.
20+
Import GHC.Base.Notations.
21+
22+
(* No type declarations to convert. *)
23+
24+
(* Converted value declarations: *)
25+
26+
Axiom trackPure : forall {k : Type},
27+
forall {v : Type},
28+
Build.Task.Task GHC.Base.Monad__Dict k v -> (k -> v) -> (v * list k)%type.
29+
30+
Axiom track : forall {m : Type -> Type},
31+
forall {k : Type},
32+
forall {v : Type},
33+
forall `{GHC.Base.Monad__Dict m},
34+
Build.Task.Task GHC.Base.Monad__Dict k v ->
35+
(k -> m v) -> m (v * list (k * v)%type)%type.
36+
37+
Definition isInput {k : Type} {v : Type}
38+
: Build.Task.Tasks GHC.Base.Monad__Dict k v -> k -> bool :=
39+
fun tasks => Data.Maybe.isNothing GHC.Base.∘ tasks.
40+
41+
Axiom computePure : forall {k : Type},
42+
forall {v : Type}, Build.Task.Task GHC.Base.Monad__Dict k v -> (k -> v) -> v.
43+
44+
Axiom compute : forall {k : Type},
45+
forall {v : Type},
46+
forall {i : Type},
47+
Build.Task.Task GHC.Base.Monad__Dict k v -> Build.Store.Store i k v -> v.
48+
49+
Axiom liftMaybe : forall {k : Type},
50+
forall {v : Type},
51+
Build.Task.Task GHC.Base.Monad__Dict k v ->
52+
Build.Task.Task GHC.Base.Monad__Dict k (option v).
53+
54+
Axiom liftEither : forall {k : Type},
55+
forall {v : Type},
56+
forall {e : Type},
57+
Build.Task.Task GHC.Base.Monad__Dict k v ->
58+
Build.Task.Task GHC.Base.Monad__Dict k (Data.Either.Either e v).
59+
60+
(* External variables:
61+
Type bool list op_zt__ option Build.Store.Store Build.Task.Task Build.Task.Tasks
62+
Data.Either.Either Data.Maybe.isNothing GHC.Base.Monad__Dict
63+
GHC.Base.op_z2218U__
64+
*)

0 commit comments

Comments
 (0)