Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-09 Thread Heinrich Apfelmus
Twan van Laarhoven wrote: For reference, here the full signature of the core combinators: data Event a data Behavior a instance Functor Behavior instance Applicative Behavior instance Functor Event instance Monoid (Event a) filter :: (a - Bool) - Event a - Event a apply :: Behavior (a - b) -

[Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread Heinrich Apfelmus
Hello, I'm writing a small Haskell library for functional reactive programming. The core of the library consists of two data types and several primitives. However, I have programmed this core *twice*: once as a *model* that displays the intended semantics, and once as the actual

Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread Twan van Laarhoven
On 08/04/11 11:54, Heinrich Apfelmus wrote: Hello, I'm writing a small Haskell library for functional reactive programming. The core of the library consists of two data types and several primitives. However, I have programmed this core *twice*: once as a *model* that displays the intended

Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread wren ng thornton
On 4/8/11 8:55 AM, Twan van Laarhoven wrote: -- this class is useful beyond this FRP library, -- you might already be able to find it on hackage somewhere class Functor f = Filterable f where filter :: (a - Bool) - f a - f a -- filter p . fmap f == fmap f . filter (p . f) -- filter (const True)

Re: Records and type classes

1995-01-13 Thread Mark P Jones
of records (i.e. adding new fields, or removing existing fields). Ohori's system provides only selection (r.l) , update (r|x:=x+1) and construction (x=2, y=True). o By describing records and type classes as applications of the same framework (qualified types), it is clear

Re: Records and type classes

1995-01-13 Thread Martin Odersky
It seems to be the season for records -- three proposals already and I'm going to add a fourth one! Phil Wadler, Martin Wehr and I have recently completed a paper that describes a radical simplification of type classes. We restrict overloading to functions that have the instance type as first

Records and type classes

1994-05-16 Thread Simon L Peyton Jones
Here's a thought, engendered by a glass of beer in the Lamplighter's pub in Gastown, Vancouver by John Hughes, Lennart Augustsson, and Simon PJ: type classes can model extensible records. Suppose we want to define a record for a person: record Person = { Age : Int; Weight :

Re: Records and type classes

1994-05-16 Thread jones-mark
Simon suggests that: | type classes can model extensible records. Indeed, they can, and in several different ways, depending on the kind of extensible records that you want to give the programmer. The particular system that Simon outlined is pretty close to a proposal for `structures in