use CoreM monad to acquire known-to-compiler identifiers
[coq-hetmet.git] / examples / Demo.hs
1 {-# OPTIONS_GHC -XModalTypes -fflatten -funsafe-skolemize -dcore-lint -XScopedTypeVariables #-}
2 module Demo (demo) where
3
4
5 demo const mult = <[ \(y::Int) -> ~~mult y ~~(const 12) ]>
6 {-
7 demo const mult = <[ \y -> ~~(demo' 0) ]>
8   where
9    demo' 0 = const 4
10    demo' n = const 4
11 -}
12 -- demo' n = <[ ~~mult ~~(demo' (n-1)) ~~(demo' (n-1)) ]>
13
14
15
16 {-
17 demo const mult =
18    <[ \y -> let y = ~~(const 4) in ~~mult (~~mult y y) (~~mult y y) ]>
19 -}
20
21 {-
22 demo const mult =
23    <[ \(y::Int) ->
24       let four   = ~~mult four ~~(const  4)
25 --          twelve = {- {- ~~mult four -}  ~~(const 12) -} four
26       in  four
27     ]>
28 -}
29 demo ::
30     forall c . 
31          (Int -> <[Int]>@c) -> 
32         <[Int -> Int -> Int]>@c ->
33         <[Int -> Int]>@c
34
35 {-
36 demo const mult =
37  <[ let     twelve = ~~(const (12::Int))
38     in let  four    = ~~(const (4::Int))
39          in  ~~mult four twelve  ]>
40 -}
41 {-
42 demo const mult =
43  <[ let     twelve = ~~(const (12::Int))
44     in let  twelvea = twelve
45             four    = ~~(const (4::Int))
46             twelveb = twelve
47          in  ~~mult (~~mult twelvea four) (~~mult twelveb twelveb) ]>
48 -}
49
50 {-
51 demo const mult = demo' 3
52  where
53   demo' 0 = const 12
54   demo' 1 = const 12
55   demo' n = <[ ~~mult ~~(demo' (n-1)) ~~(demo' (n-2)) ]>
56 -}