[Haskell] ANN: IOSpec 0.2

2008-02-05 Thread Wouter Swierstra
I'm pleased to announce the latest version of the IOSpec library. The IOSpec library contains a pure specification of several functions in the IO monad. You can use these specifications to test, debug, and reason about impure code. You can find more information, examples, and documentation

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
new record (x = 3,y = 4) subtraction \r -> ( x = 3 | r - x) replacement \r -> (x := 3 | r) (equivalent to the above) type (x::Int,y::Char) degenerate cases: empty record (|) subtracting a label (| r - x) a record can always be determined by the presence of a '|' within parenthesis. One of the

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, John Meacham <[EMAIL PROTECTED]> wrote: > choice 2: use ', declare that any identifier that _begins_ with ' always > refers to a label selection function > > 'x point > > (snip) > > none are fully backwards compatible. I am still not sure which I like > the best, ' has a lot of appe

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread John Meacham
On Tue, Feb 05, 2008 at 05:57:24AM -0500, Cale Gibbard wrote: > On 05/02/2008, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > > saveToFile x = writeToFile "data" (show x.getValue) > > Heh, I had to read this a couple times to figure out that it wasn't > just a blatant type error, and that (.) there

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Sebastian Sylvan
On Feb 5, 2008 11:08 AM, Barney Hilken <[EMAIL PROTECTED]> wrote: > > This sort of disagreement means that nothing gets done. After my > experience with the wiki page, I don't believe anything will get done > until one of the core ghc developers makes some arbitrary decisions > and implements what

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Johannes Waldmann
> Everyone wants to add extensible records to Haskell. well ... sure records are better than tuples ... but interfaces (uh, classes) are still better IMHO but anyway, is it possible to steal the design of C#'s anonymous types (classes)? if not, then why? (this might help to clarify what we wan

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
The scoped labels paper has an interesting feature in this regard: labels with different names can be swapped at will, but labels having the same name (which is allowed) maintain their order. - Cale Yes, I know. The problem is that there are TOO MANY proposals, and they are all fundamental

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Cale Gibbard <[EMAIL PROTECTED]> wrote: > On 05/02/2008, Barney Hilken <[EMAIL PROTECTED]> wrote: > > > > Should {label := "Hi", color := blue} and {color := blue, label := > > "Hi"} have the same type? > > > > The scoped labels paper has an interesting feature in this regard

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Barney Hilken <[EMAIL PROTECTED]> wrote: > > Should {label := "Hi", color := blue} and {color := blue, label := > "Hi"} have the same type? > The scoped labels paper has an interesting feature in this regard: labels with different names can be swapped at will, but labels hav

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Barney Hilken
Everyone wants to add extensible records to Haskell. The problem is that, in a formally defined language like Haskell, we need to agree how they should behave, and there are too many conflicting ideas. I was involved recently in an attempt to try to sort out some of the alternatives (record

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Cale Gibbard <[EMAIL PROTECTED]> wrote: > Personally, I think pt{x} for extracting the x field of pt seems > not-so-unreasonable, and meshes > well with the existing syntax for record updates. I should clarify -- this is only if we can't somehow keep the existing function syntax fo

Re: [Haskell] Extensible records: Static duck typing

2008-02-05 Thread Cale Gibbard
On 05/02/2008, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > saveToFile x = writeToFile "data" (show x.getValue) Heh, I had to read this a couple times to figure out that it wasn't just a blatant type error, and that (.) there doesn't mean function composition. :) On the matter of extensible recor

[Haskell] Extensible records: Static duck typing

2008-02-05 Thread Bulat Ziganshin
Hello haskell, the principle of duck typing used in dynamic OOP languages such as Ruby and Python, is simple: if some object supports Quack method, then it can be passed to any routine that expects an object of some Duck type this principle allows to build programs in quick and easy way: we just