Quantcast
Channel: Confused about custom data types in Haskell - Stack Overflow
Browsing index pages (2 articles)

Confused about custom data types in Haskell

The task: I am trying to create a custom data type and have it able to print to the console. I also want to be able to sort it using Haskell's natural ordering.The issue: Write now, I can't get this...

View Article


Answer by Daniel Fischer for Confused about custom data types in Haskell

You need a Show instance to convert the type to a printable representation (a String). The easiest way to obtain one is to addderiving Showto the type definition.data Person = Person { first_name ::...

View Article

Browsing index pages (2 articles)


Latest Images