instance

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

instance

Alexander Chen
Hi,


data TisanInteger = Tisan Integer

instance Eq (Tisan Integer) where (Tisan v) == (Tisan v') = v == v'

prelude>
Instance_testen.hs:7:14: error:
    Not in scope: type constructor or class ‘Tisan’
    A data constructor of that name is in scope; did you mean DataKinds?
  |
7 | instance Eq (Tisan Integer) where (Tisan v) == (Tisan v') = v == v'   |              ^^^^^
[1 of 1] Compiling Main             ( Instance_testen.hs, interpreted )
Failed, no modules loaded.



what am i doing wrong?

best,


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: instance

Ut Primum
Hi,

data TisanInteger = Tisan Integer
instance Eq (Tisan Integer) where (Tisan v) == (Tisan v') = v == v'

I think the part in red is the error: you should write TisanInteger instead (with no space between Tisan and Integer):
This is because there you should put the name of the data, not its definition.

Best,

Ut


Il giorno mer 22 apr 2020 alle ore 20:11 Alexander Chen <[hidden email]> ha scritto:
Hi,


data TisanInteger = Tisan Integer

instance Eq (Tisan Integer) where (Tisan v) == (Tisan v') = v == v'

prelude>
Instance_testen.hs:7:14: error:
    Not in scope: type constructor or class ‘Tisan’
    A data constructor of that name is in scope; did you mean DataKinds?
  |
7 | instance Eq (Tisan Integer) where (Tisan v) == (Tisan v') = v == v'   |              ^^^^^
[1 of 1] Compiling Main             ( Instance_testen.hs, interpreted )
Failed, no modules loaded.



what am i doing wrong?

best,

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners