[project @ 1999-01-21 15:08:51 by sof]
authorsof <unknown>
Thu, 21 Jan 1999 15:08:51 +0000 (15:08 +0000)
committersof <unknown>
Thu, 21 Jan 1999 15:08:51 +0000 (15:08 +0000)
With Haskell98, Enum.enumFromThen can generate sequences that
are either increasing, decreasing or infinite.

ghc/compiler/typecheck/TcGenDeriv.lhs

index cc3e205..cab4e7c 100644 (file)
@@ -505,7 +505,12 @@ gen_Enum_binds tycon
            HsPar (enum_from_then_to_Expr
                    (mk_easy_App mkInt_RDR [ah_RDR])
                    (mk_easy_App mkInt_RDR [bh_RDR])
-                   (HsVar (maxtag_RDR tycon)))
+                   (HsIf  (HsApp (HsApp (HsVar gt_RDR)
+                                        (HsVar a_RDR))
+                                        (HsVar b_RDR))
+                          (HsLit (HsInt 0))
+                          (HsVar (maxtag_RDR tycon))
+                          tycon_loc))
 
     from_enum
       = mk_easy_FunMonoBind tycon_loc fromEnum_RDR [a_Pat] [] $