From: Adam Megacz Date: Tue, 4 Oct 2011 17:54:41 +0000 (-0500) Subject: Demo.hs: swap <[]> and <{}> X-Git-Url: http://git.megacz.com/?p=coq-hetmet.git;a=commitdiff_plain;h=15696408ed7f683d0a6cc89f381867819a29c240 Demo.hs: swap <[]> and <{}> --- diff --git a/examples/Demo.hs b/examples/Demo.hs index bb3bf17..7a6aee8 100644 --- a/examples/Demo.hs +++ b/examples/Demo.hs @@ -3,11 +3,11 @@ module Demo (demo) where {- demo const mult = - <[ \y -> + <{ \y -> ~~mult (~~mult y y) (~~mult y y) - ]> + }> -} @@ -17,23 +17,23 @@ demo const mult = {- demo const mult = - <[ \y -> + <{ \y -> ~~mult (~~mult (~~mult y y) (~~mult y y)) (~~mult (~~mult y y) (~~mult y y)) - ]> + }> -} {- demo const mult = - <[ \y -> ~~(foo 4) ]> + <{ \y -> ~~(foo 4) }> where foo 0 = const (12::Int) - foo n = <[ let bar = ~~(foo (n-1)) + foo n = <{ let bar = ~~(foo (n-1)) in ~~mult bar bar - ]> + }> -} @@ -41,12 +41,12 @@ demo const mult = {- demo const mult = - <[ \y -> ~~(foo 3) ]> + <{ \y -> ~~(foo 3) }> where foo 0 = const (12::Int) - foo n = <[ let recurs = ~~(foo (n-1)) + foo n = <{ let recurs = ~~(foo (n-1)) in ~~mult recurs recurs - ]> + }> -} @@ -55,9 +55,9 @@ demo const mult = demo const mult = - <[ \y -> + <{ \y -> let foo = ~~mult (~~mult foo (~~mult y foo)) y - in foo ]> + in foo }> @@ -72,12 +72,12 @@ demo const mult = {- demo const mult = - <[ \y -> ~~(foo 2 <[y]>) ]> + <{ \y -> ~~(foo 2 <{y}>) }> where foo 0 y = const (12::Int) - foo n y = <[ let recurs = ~~(foo (n-1) y) + foo n y = <{ let recurs = ~~(foo (n-1) y) in ~~mult recurs recurs - ]> + }> -} @@ -120,40 +120,40 @@ demo const mult = --- demo const mult = <[ \(y::Int) -> ~~mult y ~~(const 12) ]> --- demo' n = <[ ~~mult ~~(demo' (n-1)) ~~(demo' (n-1)) ]> +-- demo const mult = <{ \(y::Int) -> ~~mult y ~~(const 12) }> +-- demo' n = <{ ~~mult ~~(demo' (n-1)) ~~(demo' (n-1)) }> -- golden {- demo const mult = - <[ \y -> + <{ \y -> let twelve = ~~mult twelve y - in twelve ]> + in twelve }> -} {- demo const mult = - <[ \y -> let y = ~~(const 4) in ~~mult (~~mult y y) (~~mult y y) ]> + <{ \y -> let y = ~~(const 4) in ~~mult (~~mult y y) (~~mult y y) }> -} {- demo const mult = - <[ \(y::Int) -> + <{ \(y::Int) -> let four = ~~mult four ~~(const 4) -- twelve = {- {- ~~mult four -} ~~(const 12) -} four in four - ]> + }> -} demo :: forall c . - (Int -> <[Int]>@c) -> - <[Int -> Int -> Int]>@c -> - <[Int -> Int]>@c + (Int -> <{Int}>@c) -> + <{Int -> Int -> Int}>@c -> + <{Int -> Int}>@c {- demo const mult = - <[ let twelve = ~~(const (12::Int)) + <{ let twelve = ~~(const (12::Int)) in let four = ~~(const (4::Int)) - in ~~mult four twelve ]> + in ~~mult four twelve }> -} {- @@ -161,11 +161,11 @@ demo const mult = demo' 3 where demo' 0 = const 12 demo' 1 = const 12 - demo' n = <[ ~~mult ~~(demo' (n-1)) ~~(demo' (n-2)) ]> + demo' n = <{ ~~mult ~~(demo' (n-1)) ~~(demo' (n-2)) }> -} -- BUG ---demo const mult = <[ \y -> ~~(demo' 0) ]> +--demo const mult = <{ \y -> ~~(demo' 0) }> -- where -- demo' 0 = const 4 -- demo' n = const 4