haskell - Could not deduce (Show t) -


i have piece of code in haskell refuses compile:

data (eq a, num a, show a) => mat = mat {nexp :: int, mat :: qt a}  deriving (eq, show)  data (eq , show ) => qt = c | q (qt ) (qt ) (qt ) (qt )  deriving (eq, show)   cs:: (num t) => mat t -> [t]  cs(mat nexp (q b c d)) =(css (nexp-1) c)++(css (nexp-1) b d)             css 0 (c a) (c b) = (a-b):[]         css nexp (q b c d) (q e f g h) = (zipwith (+) (css (nexp-1) c) (css (nexp-1) e g))++(zipwith (+)(css (nexp-1) b d) (css (nexp-1) f h)) 

i have error:

could not deduce (show t) arising use of `mat' context (num t) bound type signature cs:: num t => mat t -> [t] 

i searched online , found many similar questions, nothing seems close problem. how can make code work?

class constraints on data types don't mean anything.

see this related question

remove constraint on data type.

data mat = mat {nexp :: int, mat :: qt a}     deriving (eq, show) 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -