Commit f5623ee9 authored by Tim Steenvoorden's avatar Tim Steenvoorden

fully write out type names

parent 6978e61e
...@@ -75,7 +75,7 @@ where ...@@ -75,7 +75,7 @@ where
= Int Int = Int Int
| Bool Bool | Bool Bool
| String String | String String
| Tuple Expr Expr | Pair Expr Expr
| Apply Func Expr | Apply Func Expr
:: Func :: Func
...@@ -100,7 +100,7 @@ where ...@@ -100,7 +100,7 @@ where
| VInt Int | VInt Int
| VBool Bool | VBool Bool
| VString String | VString String
| VTuple Value Value | VPair Value Value
:: Ty :: Ty
= E.a: Ty (a -> Value) & iTask a = E.a: Ty (a -> Value) & iTask a
...@@ -347,9 +347,9 @@ taskEditor = DynamicEditor ...@@ -347,9 +347,9 @@ taskEditor = DynamicEditor
, functionConsDyn "String" "the string" , functionConsDyn "String" "the string"
(dynamic \s -> Typed (String s) :: String -> Typed Expr String) (dynamic \s -> Typed (String s) :: String -> Typed Expr String)
<<@@@ applyHorizontalLayout <<@@@ applyHorizontalLayout
, functionConsDyn "Tuple" "the tuple" , functionConsDyn "Pair" "the pair"
( dynamic \(Typed a) (Typed b) -> ( dynamic \(Typed a) (Typed b) ->
Typed (Tuple a b) :: Typed (Pair a b) ::
A.a b: A.a b:
(Typed Expr a) (Typed Expr b) -> Typed Expr (a, b) (Typed Expr a) (Typed Expr b) -> Typed Expr (a, b)
) )
...@@ -358,17 +358,17 @@ taskEditor = DynamicEditor ...@@ -358,17 +358,17 @@ taskEditor = DynamicEditor
] ]
// Types // Types
, DynamicConsGroup "Types" , DynamicConsGroup "Types"
[ functionConsDyn "Ty.Int" "Int" [ functionConsDyn "Ty.Int" "Integer"
(dynamic Typed (Ty VInt) :: Typed Ty Int) (dynamic Typed (Ty VInt) :: Typed Ty Int)
<<@@@ applyHorizontalLayout <<@@@ applyHorizontalLayout
, functionConsDyn "Ty.Bool" "Bool" , functionConsDyn "Ty.Bool" "Boolean"
(dynamic Typed (Ty VBool) :: Typed Ty Bool) (dynamic Typed (Ty VBool) :: Typed Ty Bool)
<<@@@ applyHorizontalLayout <<@@@ applyHorizontalLayout
, functionConsDyn "Ty.String" "String" , functionConsDyn "Ty.String" "String"
(dynamic Typed (Ty VString) :: Typed Ty String) (dynamic Typed (Ty VString) :: Typed Ty String)
<<@@@ applyHorizontalLayout <<@@@ applyHorizontalLayout
, functionConsDyn "Ty.Tuple" "Tuple" , functionConsDyn "Ty.Pair" "Pair"
( dynamic \(Typed (Ty toValue1)) (Typed (Ty toValue2)) -> Typed (Ty \(x, y) -> VTuple (toValue1 x) (toValue2 y)) :: ( dynamic \(Typed (Ty toValue1)) (Typed (Ty toValue2)) -> Typed (Ty \(x, y) -> VPair (toValue1 x) (toValue2 y)) ::
A.a b: A.a b:
(Typed Ty a) (Typed Ty b) -> Typed Ty (a, b) (Typed Ty a) (Typed Ty b) -> Typed Ty (a, b)
) )
...@@ -413,7 +413,7 @@ evalTaskExpr :: TaskExpr -> Task Value ...@@ -413,7 +413,7 @@ evalTaskExpr :: TaskExpr -> Task Value
evalTaskExpr (Done expr) = return $ evalExpr expr evalTaskExpr (Done expr) = return $ evalExpr expr
evalTaskExpr (EnterInfo (Ty toValue) msg) = enterInformation msg [] @ toValue evalTaskExpr (EnterInfo (Ty toValue) msg) = enterInformation msg [] @ toValue
evalTaskExpr (Then task taskFunc) = evalTaskExpr task >>= evalTaskFunc taskFunc evalTaskExpr (Then task taskFunc) = evalTaskExpr task >>= evalTaskFunc taskFunc
evalTaskExpr (Both task1 task2) = (evalTaskExpr task1 -&&- evalTaskExpr task2) <<@ ApplyLayout arrangeHorizontal @ \(a, b) -> VTuple a b evalTaskExpr (Both task1 task2) = (evalTaskExpr task1 -&&- evalTaskExpr task2) <<@ ApplyLayout arrangeHorizontal @ \(a, b) -> VPair a b
evalTaskExpr (Any task1 task2) = (evalTaskExpr task1 -||- evalTaskExpr task2) <<@ ApplyLayout arrangeHorizontal evalTaskExpr (Any task1 task2) = (evalTaskExpr task1 -||- evalTaskExpr task2) <<@ ApplyLayout arrangeHorizontal
evalTaskExpr (One button1 task1 button2 task2) = viewInformation "Make a choice" [] () >?> evalTaskExpr (One button1 task1 button2 task2) = viewInformation "Make a choice" [] () >?>
[ ( button1, const True, \_ -> evalTaskExpr task1 ) [ ( button1, const True, \_ -> evalTaskExpr task1 )
...@@ -446,10 +446,10 @@ evalTaskFunc (ViewF msg func) val = case evalFunc val func of ...@@ -446,10 +446,10 @@ evalTaskFunc (ViewF msg func) val = case evalFunc val func of
(VInt i) -> (viewInformation msg [] i @ VInt) <<@ ApplyLayout arrangeHorizontal (VInt i) -> (viewInformation msg [] i @ VInt) <<@ ApplyLayout arrangeHorizontal
(VBool b) -> (viewInformation msg [] b @ VBool) <<@ ApplyLayout arrangeHorizontal (VBool b) -> (viewInformation msg [] b @ VBool) <<@ ApplyLayout arrangeHorizontal
(VString s) -> (viewInformation msg [] s @ VString) <<@ ApplyLayout arrangeHorizontal (VString s) -> (viewInformation msg [] s @ VString) <<@ ApplyLayout arrangeHorizontal
(VTuple a b) -> (VPair a b) ->
( viewInformation msg [] () ( viewInformation msg [] ()
||- (evalTaskFunc (ViewF "" Identity) a -&&- evalTaskFunc (ViewF "" Identity) b) ||- (evalTaskFunc (ViewF "" Identity) a -&&- evalTaskFunc (ViewF "" Identity) b)
@ \(a, b) -> VTuple a b @ \(a, b) -> VPair a b
) )
<<@ ApplyLayout arrangeHorizontal <<@ ApplyLayout arrangeHorizontal
...@@ -457,10 +457,10 @@ evalTaskFunc (UpdateF msg func) val = case evalFunc val func of ...@@ -457,10 +457,10 @@ evalTaskFunc (UpdateF msg func) val = case evalFunc val func of
(VInt i) -> (updateInformation msg [] i @ VInt) <<@ ApplyLayout arrangeHorizontal (VInt i) -> (updateInformation msg [] i @ VInt) <<@ ApplyLayout arrangeHorizontal
(VBool b) -> (updateInformation msg [] b @ VBool) <<@ ApplyLayout arrangeHorizontal (VBool b) -> (updateInformation msg [] b @ VBool) <<@ ApplyLayout arrangeHorizontal
(VString s) -> (updateInformation msg [] s @ VString) <<@ ApplyLayout arrangeHorizontal (VString s) -> (updateInformation msg [] s @ VString) <<@ ApplyLayout arrangeHorizontal
(VTuple a b) -> (VPair a b) ->
( viewInformation msg [] () ( viewInformation msg [] ()
||- (evalTaskFunc (UpdateF "" Identity) a -&&- evalTaskFunc (UpdateF "" Identity) b) ||- (evalTaskFunc (UpdateF "" Identity) a -&&- evalTaskFunc (UpdateF "" Identity) b)
@ \(a, b) -> VTuple a b @ \(a, b) -> VPair a b
) )
<<@ ApplyLayout arrangeHorizontal <<@ ApplyLayout arrangeHorizontal
...@@ -477,7 +477,7 @@ evalExpr :: Expr -> Value ...@@ -477,7 +477,7 @@ evalExpr :: Expr -> Value
evalExpr (Int i) = VInt i evalExpr (Int i) = VInt i
evalExpr (Bool b) = VBool b evalExpr (Bool b) = VBool b
evalExpr (String s) = VString s evalExpr (String s) = VString s
evalExpr (Tuple fstExpr sndExpr) = VTuple (evalExpr fstExpr) (evalExpr sndExpr) evalExpr (Pair fstExpr sndExpr) = VPair (evalExpr fstExpr) (evalExpr sndExpr)
evalExpr (Apply func expr) = evalFunc (evalExpr expr) func evalExpr (Apply func expr) = evalFunc (evalExpr expr) func
...@@ -516,7 +516,7 @@ where ...@@ -516,7 +516,7 @@ where
evalString expr = case evalExpr expr of evalString expr = case evalExpr expr of
(VString s) -> s (VString s) -> s
evalFunc (VTuple x1 x2) func = case func of evalFunc (VPair x1 x2) func = case func of
Fst -> x1 Fst -> x1
Snd -> x2 Snd -> x2
...@@ -527,4 +527,4 @@ instance toString Value where ...@@ -527,4 +527,4 @@ instance toString Value where
VInt i -> toString i VInt i -> toString i
VBool b -> toString b VBool b -> toString b
VString s -> toString s VString s -> toString s
VTuple x y -> "( " +++ toString x +++ ", " +++ toString y +++ " )" VPair x y -> "( " +++ toString x +++ ", " +++ toString y +++ " )"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment