move to new normalization-based optimizer, add GArrowSkeleton.beautify
[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 =
8    <[ \y -> let y = ~~(const 4) in ~~mult (~~mult y y) (~~mult y y) ]>
9
10 {-
11 demo const mult =
12    <[ \(y::Int) ->
13       let four   = ~~mult four ~~(const  4)
14 --          twelve = {- {- ~~mult four -}  ~~(const 12) -} four
15       in  four
16     ]>
17 -}
18 demo ::
19     forall c . 
20          (Int -> <[Int]>@c) -> 
21         <[Int -> Int -> Int]>@c ->
22         <[Int -> Int]>@c
23
24 {-
25 demo const mult =
26  <[ let     twelve = ~~(const (12::Int))
27     in let  four    = ~~(const (4::Int))
28          in  ~~mult four twelve  ]>
29 -}
30 {-
31 demo const mult =
32  <[ let     twelve = ~~(const (12::Int))
33     in let  twelvea = twelve
34             four    = ~~(const (4::Int))
35             twelveb = twelve
36          in  ~~mult (~~mult twelvea four) (~~mult twelveb twelveb) ]>
37 -}
38
39 {-
40 demo const mult = demo' 3
41  where
42   demo' 0 = const 12
43   demo' 1 = const 12
44   demo' n = <[ ~~mult ~~(demo' (n-1)) ~~(demo' (n-2)) ]>
45 -}