[Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-29 Thread oleg
Alp Mestan wrote: Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo Hi !;; val f : foo : string - 'a; .. - 'a = fun* And Haskell has that too: -- This is how we define labels. data Field1 deriving Typeable; field1 = proxy::Proxy Field1 --

[Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Peter Verswyvelen
Haskell's records are a bit annoying, and type-classes often group together too many methods, which means you make early decisions about future unknown requirements, and IMO you always get it wrong :-) After having read an email in the cafe about the Noop language Self language, I realized that

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Job Vranish
Short answer: There is no good way of doing what you want. This is actually one of my biggest annoyances with haskell (right up there with disallowing infinite types). They are many techniques that work better or worse depending on the application, but non are very satisfactory IMO. Your typeclass

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Alp Mestan
On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote: Supposedly OCaml has an OO feature that does this but I haven't tried it out. Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo Hi !;; val f : foo : string - 'a; .. - 'a =

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Casey Hawthorne
On Fri, 25 Sep 2009 23:25:21 +0200, you wrote: On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote: Supposedly OCaml has an OO feature that does this but I haven't tried it out. Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Casey Hawthorne
On Fri, 25 Sep 2009 23:25:21 +0200, you wrote: On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote: Supposedly OCaml has an OO feature that does this but I haven't tried it out. Indeed, OCaml has stuctural polymorphism, it's a wonderful feature. *# let f myobj = myobj#foo

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread wren ng thornton
Peter Verswyvelen wrote: After having read an email in the cafe about the Noop language Self language, I realized that what I really would like to have is strong duck typing on records (or is it called structural subtyping? or prototype-based-objects? or something like that) The common name

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Sebastian Sylvan
On Fri, Sep 25, 2009 at 10:55 PM, Casey Hawthorne cas...@istar.ca wrote: On Fri, 25 Sep 2009 23:25:21 +0200, you wrote: On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote: Supposedly OCaml has an OO feature that does this but I haven't tried it out. Indeed, OCaml