Zulip Chat Archive
Stream: general
Topic: deriving Repr
Qin Yuxuan (Jul 23 2023 at 08:20):
structure Point where
x : Float
y : Float
deriving Repr
What does deriving Repr
mean?
Qin Yuxuan (Jul 23 2023 at 08:20):
structure Point where
x : Float
y : Float
deriving Repr
What does deriving Repr
mean?
Henrik Böving (Jul 23 2023 at 08:50):
"Figure out a Repr
implementation automatically for this type given that all members of the type implement Repr
themselves already"
Bhakti Shah (Jul 24 2023 at 20:05):
slightly tangential question: is there a difference between deriving Repr
(right by the type definition) and deriving instance Repr for Type
except for where you can place the statement? I've seen both but I'm not sure if there's a difference.
Henrik Böving (Jul 24 2023 at 20:06):
No, the main reason we have the second syntax is that you can for example have a type declared in some other module or even library and later still derive type class instances on it.
Last updated: Dec 20 2023 at 11:08 UTC