Commit f646f715 authored by Camil Staps's avatar Camil Staps 🚀

Merge branch 'unitInstances' into 'master'

add instances for ()

See merge request !26
parents aecdb777 88e06c82
Pipeline #26738 passed with stage
in 1 minute and 2 seconds
......@@ -58,7 +58,7 @@ ggenString :: Int Real Int Int RandomStream -> [String]
derive ggen Int, Bool, Real, Char, String
derive ggen UNIT, PAIR, EITHER, CONS of gcd, OBJECT of gtd, FIELD of d, RECORD of grd
derive ggen (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
derive ggen (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
derive ggen [], [!], [ !], [!!]
derive ggen {}, {!}
......
......@@ -211,7 +211,7 @@ where
ggen{|String|} s = ["hello world!","Gast","":ggenString StrLen 4.0 32 126 aStream]
derive ggen (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
derive ggen (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
derive ggen [], [!], [ !], [!!]
ggen{|{}|} fx r = [{x \\ x <- xs} \\ xs <- ggen{|*->*|} fx r]
ggen{|{!}|} fx r = [{x \\ x <- xs} \\ xs <- ggen{|*->*|} fx r]
......
......@@ -25,7 +25,7 @@ generic gLess a :: a a -> Bool
derive genShow Int, Char, Bool, Real, String,
UNIT, PAIR, EITHER, OBJECT, CONS of {gcd_name,gcd_arity}, RECORD of {grd_name}, FIELD of {gfd_name},
{}, {!}, [], [!], [ !], [!!], (->),
(,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,), (,,,,,,,,), (,,,,,,,,,)
(), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,), (,,,,,,,,), (,,,,,,,,,)
derive gLess Int, Char, Bool, Real, String,
UNIT, PAIR, EITHER, OBJECT, CONS, FIELD, RECORD,
[],
......
......@@ -42,6 +42,7 @@ genShow{|[]|} f sep p xs rest = ["[" :showList f xs [ "]":rest]]
genShow{|[!]|} f sep p xs rest = ["[!":showList f xs [ "]":rest]]
genShow{|[ !]|} f sep p xs rest = ["[" :showList f xs ["!]":rest]]
genShow{|[!!]|} f sep p xs rest = ["[!":showList f xs ["!]":rest]]
genShow{|()|} _ _ _ rest = ["()": rest]
genShow{|(,)|} f1 f2 sep p (x1,x2) rest = ["(":f1 sep False x1 [",":f2 sep False x2 [")":rest]]]
genShow{|(,,)|} f1 f2 f3 sep p (x1,x2,x3) rest = ["(":f1 sep False x1 [",":f2 sep False x2 [",":f3 sep False x3 [")":rest]]]]
genShow{|(,,,)|} f1 f2 f3 f4 sep p (x1,x2,x3,x4) rest
......
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