Here's a quick example using ghci:

Prelude> let a = Person length
Prelude> :type a
a :: Person
Prelude> (firstName a) "Bob"
3


On Tue, May 5, 2015 at 10:19 PM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:
Hi, 

Could anyone please have a look and let me know how you can create the instance of this data type ?

---
 data Person = Person { firstName ::String -> Int }
---

I've seen this type of syntax in a lot of places in haskell code where a new data type is defined in terms of functions rather than concrete data types.

I am not trying to achieve anything out of this but purely as an exercise in understanding the record syntax.

As far as I understand the data type is function based and takes a 'function' instead of a value of a concrete type so how does one create an instance of this type.

Thanks,
Shishir 

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners