[Ur] Deriving show instances
Ron de Bruijn
rmbruijn at gmail.com
Wed Oct 12 04:31:00 EDT 2011
Hi,
In Haskell one can write:
module Blah where
data Omg a = Omg a
deriving Show
ghci> show (Omg 1)
"Omg 1",
but in Ur/Web we need to write this boilerplate by hand.
I would even prefer to have everything which can be be derived to be
automatically there unless a manual instance is specified.
So,
I would like that
datatype Foo a = Foo of a
val y = show (Foo 1)
compiles and does what is obviously intended unless another Foo specific show
instance has been defined.
Since Ur/Web uses whole-program compilation anyway, this is not a problem.
Also, everywhere I write 'show' you should read every typeclass mentioned on
http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html , since
that is the level of sophistication users of modern languages expect these days.
Completely unrelated: opalang.org doesn't appear to have actual datatypes. Or
rather they have disjoint sums of record types to make the language more
uniform. Is there any particular reason that this isn't done in Ur/Web? It seems
that their approach is more sensible in a language with row variables.
--
Best regards,
Ron de Bruijn
More information about the Ur
mailing list