haskell - Lists of data types: "could not deduce (a ~ SomeType) from the context (SomeTypeclass a)" -


I have the following problem with Haskell type systems: I am trying to declare a data type and returning the list of elements in this list. Type from the function Unfortunately, even the least test case like
  type the data sample = type sample type example example samples where show x = "(sample type)" stList: : (A) = & gt; [A] stList = [[SampleTypeConstructor]] Main = do {putStrLn (show stList)}   

Both failed with the following error message from ghc-7.0.2 and ghc-7.1.20110327 :

  tcase.hs: 7: 12: could not be extracted from a reference (a ~ sample type) (Show one) bound by type signature for stList :: Show a = & gt ; [A] at tce.hs: 7: 1-34 'A' is a hard type variable bound by type sign for stList :: Show a => In Expression: (Sample Type Constructor) expression: [(Sample Type Constructor) in an equation for `Stist ': stList = [[Sample Type Constructor]]    

offensive line stList :: (a) => [ONE] . You are declaring that StList is a multicolored list that holds any element that satisfies the show's limit. But the stList is not a polymorphic list! If this is a list of SampleType s, then remove the signature and see if you guess dirty or just give the correct signature: :: [sample type] .

Comments