Hi all, I've been writing a DSL to describe securities orders, and after a lot of help from the kind folk of this list and #haskell have come up with the following implementation, using generalised algebraic data types:
https://gist.github.com/1124621 Elsewhere in my application, I make use of the order type defined therein in the following newtype declaration: newtype OrderListLevel s = OrderListLevel {orders :: [Order s Limit]} deriving (Eq, Show) However, the 'deriving' clause here fails: src/Simulation/OrderList.hs:9:82: No instance for (Eq (Order s Limit)) arising from the 'deriving' clause of a data type declaration at src/Simulation/OrderList.hs:9:82-83 src/Simulation/OrderList.hs:9:86: No instance for (Show (Order s Limit)) arising from the 'deriving' clause of a data type declaration at src/Simulation/OrderList.hs:9:86-89 I don't fully understand this - the error is correct that there is no instance of either Eq or Show for (Order s Limit), however, instances are defined for Order Buy Limit and Order Sell Limit, and since these are the only possible types that a value can be constructed with (the type constructor is 'closed' over these types in some sense I guess), it seems to me that this should provide enough information to derive the Eq and Show instances. Am I making unreasonable expectations of ghci's instance-deriving mechanism here, or missing something obvious? Many thanks in advance, Tim _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe