Given the following code
{-# LANGUAGE StandaloneDeriving #-}
type Date = Int
data Decision a = Decision a deriving (Show)
data InProgress a = InProgress {progress :: a, decision :: Decision a } deriving (Show)
data Finished a = Finished {finished :: a, initial :: a, timestamp :: Date } deriving (Show)
data LineItem a = LineItem {article :: a String, amount :: a Float, units :: a Int } deriving (Show)
I get the following error
source_file.hs:11:96:
No instance for (Show (a Float))
arising from the second field of ‘LineItem’ (type ‘a Float’)
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Show (LineItem a))
I tried some variations like this below - but I cant get it run.
deriving instance Show a => Show (InProgress Float)
How can I fix this? (and some explanation would be really appreciated)
Edit
Okay, I have the solution
deriving instance Show (LineItem InProgress)
will do what I want. Still I dont get why its not
deriving instance Show a => Show (LineItem (InProgress a))