Add type hints for move, scale, and rotate.

This commit is contained in:
evancz 2012-07-31 15:36:26 +02:00
parent 46cb69f5c6
commit 033fa66e5a
2 changed files with 7 additions and 3 deletions

View file

@ -47,6 +47,9 @@ shapes = [ twoNums (\n m -> listOf (pairOf n) ==> pairOf m ==> shape) "polygon"
, "filled" -: color ==> shape ==> form , "filled" -: color ==> shape ==> form
, "outlined" -: color ==> shape ==> form , "outlined" -: color ==> shape ==> form
, "customOutline" -: listOf int ==> color ==> shape ==> form , "customOutline" -: listOf int ==> color ==> shape ==> form
, scheme2 number transformable (\n t -> n ==> n ==> t ==> t) "move"
, scheme2 number transformable (\n t -> n ==> t ==> t) "rotate"
, scheme2 number transformable (\n t -> n ==> t ==> t) "scale"
] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon" ] ++ map (twoNums (\n m -> n ==> n ==> pairOf m ==> shape)) [ "ngon"
, "rect" , "rect"
, "oval" ] , "oval" ]
@ -141,11 +144,11 @@ concreteSignals =
binop t = t ==> t ==> t binop t = t ==> t ==> t
scheme1 super t name = (name, Forall [0] [VarT 0 :<: super] (t (VarT 0))) scheme1 super t name = (name, Forall [0] [VarT 0 :<: super] (t (VarT 0)))
scheme2 s1 s2 t name =
(name, Forall [0,1] [VarT 0 :<: s1, VarT 1 :<: s2] (t (VarT 0) (VarT 1)))
numScheme t name = scheme1 number t name numScheme t name = scheme1 number t name
timeScheme name t = scheme1 time t name timeScheme name t = scheme1 time t name
twoNums f name = twoNums f name = scheme2 number number f name
(,) name . Forall [0,1] [ VarT 0 :<: number, VarT 1 :<: number ] $
f (VarT 0) (VarT 1)
math = math =
map (numScheme (\t -> t ==> binop t)) ["clamp"] ++ map (numScheme (\t -> t ==> binop t)) ["clamp"] ++

View file

@ -51,6 +51,7 @@ pairOf t = tupleOf [t,t]
point = pairOf int point = pairOf int
appendable t = SuperType "Appendable" (Set.fromList [ string, text, listOf t ]) appendable t = SuperType "Appendable" (Set.fromList [ string, text, listOf t ])
comparable = SuperType "Comparable" (Set.fromList [ int, float, char, string, tipe "Number", tipe "Time" ]) comparable = SuperType "Comparable" (Set.fromList [ int, float, char, string, tipe "Number", tipe "Time" ])
transformable = SuperType "Transformable" (Set.fromList [ shape, line ])
jsBool = tipe "JSBool" jsBool = tipe "JSBool"
jsNumber = tipe "JSNumber" jsNumber = tipe "JSNumber"