-{-# OPTIONS_GHC -XRankNTypes -XScopedTypeVariables -XFlexibleContexts -XModalTypes -XKindSignatures -fcoqpass -XMultiParamTypeClasses -dcore-lint #-}
-module Demo (foo) where
-import GHC.HetMet.GArrow
-import GHC.HetMet.CodeTypes
-import GHC.HetMet.Private
---import GArrowTikZ
+{-# OPTIONS_GHC -XModalTypes -fflatten -funsafe-skolemize -dcore-lint -XScopedTypeVariables -fsimpleopt-before-flatten #-}
+module Demo ({-sample1,sample2,-}sample5,sample6) where
+
+sample5 :: forall c . (Int -> <{Int}>@c) -> <{Int -> Int -> Int}>@c -> <{Int -> Int}>@c
+sample5 const <[ (*) ]> =
+ <{ \y ->
+ let foo = (~~(const 3) * foo) * y
+ in foo }>
+
+sample6 :: forall c . (Int -> <{Int}>@c) -> <{Int -> Int -> Int}>@c -> <{Int -> Int}>@c
+sample6 const <{ (*) }> = pow 6
+ where
+ --pow :: Int -> <{ Int -> Int }>@a
+ pow 0 = <{ \x -> ~~(const 1) }>
+ pow 1 = <{ \x -> x }>
+ pow n = <{ \x -> x * ~~(pow (n - 1)) x }>
+
+demo2 ::
+ forall c .
+ (Int -> <{Int}>@c) ->
+ <{Int -> Int -> Int}>@c ->
+ <{Int -> Int}>@c
+
+demo2 const mult =
+ <{ \y ->
+ ~~mult
+ (~~(const 1))
+ (~~mult y y)
+ }>
+
+
+
+
+
+
+
+{-
+demo const mult =
+ <{ \y ->
+ ~~mult
+ (~~mult (~~mult y y) (~~mult y y))
+ (~~mult (~~mult y y) (~~mult y y))
+ }>
+-}
+
+
+
+{-
+demo const mult =
+ <{ \y -> ~~(foo 4) }>
+ where
+ foo 0 = const (12::Int)
+ foo n = <{ let bar = ~~(foo (n-1))
+ in ~~mult bar bar
+ }>
+
+-}
+
+