Compiler crashes for some derivations of [# !] and [#] in combination with newtypes
The problem occurs on linux 64 bit both using the stable compiler and the iTask compiler from the latest nightly.
The following results in a compiler crash:
module test
import StdEnv, StdGeneric
:: Box b a =: Box b
derive bimap Box
unBox (Box b) :== b
box b :== Box b
isInfinite :: ([String] -> Box Bool a) -> Bool
isInfinite f = unBox (f [])
generic gPotentialInf a :: [String] -> Box Bool a
derive gPotentialInf [#]
gPotentialInf{|Int|} _ = box False
gPotentialInf{|UNIT|} _ = box False
gPotentialInf{|EITHER|} l r m = box (unBox (l m) || unBox (r m))
gPotentialInf{|PAIR|} l r m = box (unBox (l m) || unBox (r m))
gPotentialInf{|CONS|} x m = box (unBox (x m))
gPotentialInf{|OBJECT of {gtd_name}|} x m
| isMember gtd_name m = box True
= box (unBox (x [gtd_name:m]))
Start :: Bool
Start = isInfinite t
where
t :: ([String] -> Box Bool [#Int])
t = gPotentialInf{|*|}
- Deriving regular lists works fine with the newtype
- Changing
Box
to:: Box a b = Box b | Unused a
works as well