diff options
author | Camil Staps | 2017-09-21 23:44:39 +0200 |
---|---|---|
committer | Camil Staps | 2017-09-21 23:44:39 +0200 |
commit | 86fa6241b18449e713a2a4d401f22cbf00d2970a (patch) | |
tree | e74b2587136357e5d29a4d016d0c1af9a8e12ba7 /assignment-2 | |
parent | Reflection (diff) |
Preparing for hand-in
Diffstat (limited to 'assignment-2')
-rw-r--r-- | assignment-2/serialize2start.icl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/assignment-2/serialize2start.icl b/assignment-2/serialize2start.icl index d8b5ccc..3717b9c 100644 --- a/assignment-2/serialize2start.icl +++ b/assignment-2/serialize2start.icl @@ -4,6 +4,9 @@ module serialize2start Definition for assignment 2 in AFP 2017
Pieter Koopman pieter@cs.ru.nl
September 2017
+
+ Laurens Kuiper (s4467299)
+ Camil Staps (s4498062)
*/
import StdEnv, StdMaybe
@@ -132,6 +135,16 @@ where Nothing -> case read r of
Just (x,r) -> Just (RIGHT x,r)
Nothing -> Nothing
+ // This goes wrong if the two type variables of EITHER are equal (and
+ // hence read for LEFT is the same as read for RIGHT: we will always
+ // return a LEFT. Therefore, given a type
+ //
+ // :: T = C1 Int | C2 Int
+ //
+ // it is not possible to write and read C2 (C1 will be read, since LEFT
+ // has precedence). Like the example given as the answer to the
+ // reflection questin below, we don't think this to be fixable in the
+ // current setup.
instance serialize (PAIR a b) | serialize a & serialize b
where
|