Commit 6a834ac7 authored by Reg Huijben's avatar Reg Huijben

Minor cleanup

parent 08ae6cbf
......@@ -123,7 +123,7 @@ instance serialize (EITHER a b) | serialize a & serialize b where
Nothing -> case read r of // if that fails, try to parse the right side
Just (a,r) -> Just (RIGHT a ,r)
Nothing -> Nothing
// Don't flip left and right though, that makes reading using the 'unit without parentheses' take very long
// Don't flip left and right though, that makes reading using the 'unit without parentheses' not work
......@@ -134,13 +134,10 @@ instance serialize (CONS a) | serialize a & isUnit a where
// [s: written++c] // unit without parentheses
// ["(":s: (written ++ [")":c])] // else with parentheses
write (CONS s a) c = //let aa = isUnit a in
if (isUnit a)//(fst aa)
write (CONS s a) c = if (isUnit a)
[s: (write a c)] // unit without parentheses
["(":s: (write a [")":c])] // else with parentheses
// (snd aa)
read ["(":s:r] = case read r of
Just (a,[")":r]) -> Just(CONS s a, r)
_ -> Nothing
......@@ -242,7 +239,7 @@ instance conses (EITHER a b) | conses a & conses b where
conses (RIGHT b) = conses b
instance conses (CONS a) | conses a & isUnit a where
conses (CONS _ a) = conses a + if ( (isUnit a)) 0 1
conses (CONS _ a) = conses a + if (isUnit a) 0 1
//
//
......
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