translating tweaks
authorJim Pryor <profjim@jimpryor.net>
Sat, 4 Dec 2010 19:05:12 +0000 (14:05 -0500)
committerJim Pryor <profjim@jimpryor.net>
Sat, 4 Dec 2010 19:05:12 +0000 (14:05 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
translating_between_OCaml_Scheme_and_Haskell.mdwn

index 40f518a..4a4287a 100644 (file)
@@ -199,6 +199,12 @@ We will however try to give some general advice about how to translate between O
                type person = name * address;;
                type 'a personal_data = PD of 'a;;
 
+*      When a type only has a single variant, as with PersonalData, Haskell programmers will often use the same name for both the type and the value constructor, like this:
+
+               data PersonalData a = PersonalData a
+
+       The interpreter can always tell from the context when you're using the type name and when you're using the value constructor.
+
 *      The type constructors discussed above took simple types as arguments. In Haskell, types are also allowed to take *type constructors* as arguments:
 
                data BarType t = Bint (t Integer) | Bstring (t string)