2

I'm trying to define a polymorphic list of tuples without using any imports. i have data ListT a = [(a,String)] deriving (Eq,Ord,Read,Show) but it keeps giving the error "cannot parse data constructor in a data/newtype declaration: [(a,String)]"

What does this error mean, and how do I prevent it. Thanks

3
  • 1
    Maybe you wanted type ListT a = [(a, String)]? Commented Oct 20, 2015 at 20:24
  • 1
    To avoid confusion you might want to choose a different name - ListT is used in the Haskell community for the monad transformer for the List type. Commented Oct 20, 2015 at 20:29
  • 1
    okay, thanks i'll change it Commented Oct 20, 2015 at 20:38

1 Answer 1

7

It means that you forgot to provide the name for the value constructor. You need to change your code to the following:

data ListT a = ListT [(a,String)]

BTW, it is not a proper implementation of List Transformer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.