[Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread Casey Hawthorne
How does one delare a 2D STUArray in Haskell? I see the following from a diffusion program segment: module Diffusion where import Data.Array import Data.List (sortBy) type VFieldElem = Float type VField = Array (Int,Int) VFieldElem snip zeros = listArray ((1,1),(imax,jmax)) (repeat 0)

Re: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread minh thu
2009/9/25 Casey Hawthorne cas...@istar.ca: How does one delare a 2D STUArray in Haskell? Hi, STUArray, like other arrays is parametrized by the type of the index, the i in STUArray s i e [1]. That i is should be an instance of Ix which is a class of the types that can be used as indices. If you

Re: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread Casey Hawthorne
Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? STUArray s i e Could you also have a tuple of states? Obviosly, 'e' could be a tuple, for instance (Int,Char) -- Regards, Casey

Re: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread minh thu
2009/9/25 Casey Hawthorne cas...@istar.ca: Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? STUArray s i e Could you also have a tuple of states? Obviosly, 'e' could be a tuple, for instance

Re: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread minh thu
2009/9/25 minh thu not...@gmail.com: 2009/9/25 Casey Hawthorne cas...@istar.ca: Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? STUArray s i e Could you also have a tuple of states? Obviosly,

RE: [Haskell-cafe] Haddock and literate Haskell: annotations must bemarked as source?

2009-09-25 Thread Bayley, Alistair
From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Andy Gimblett Sent: 24 September 2009 20:19 On 24 Sep 2009, at 20:10, Duncan Coutts wrote: On Thu, 2009-09-24 at 19:48 +0100, Andy Gimblett wrote: That's great news for me, except: that's

Re: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread Daniel Fischer
Am Freitag 25 September 2009 09:22:25 schrieb Casey Hawthorne: Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? minh thu already explained this very well. STUArray s i e Could you also have a

Re[2]: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread Bulat Ziganshin
Hello Casey, Friday, September 25, 2009, 11:22:25 AM, you wrote: Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? look at Ix class instances:

[Haskell-cafe] Proof in Haskell

2009-09-25 Thread pat browne
Hi, Below is a function that returns a mirror of a tree, originally from: http://www.nijoruj.org/~as/2009/04/20/A-little-fun.html where it was used to demonstrate the use of Haskabelle(1) which converts Haskell programs to the Isabelle theorem prover. Isabelle was used to show that the Haskell

Re: [Haskell-cafe] Proof in Haskell

2009-09-25 Thread Eugene Kirpichov
It is not possible at the value level, because Haskell does not support dependent types and thus cannot express the type of the proposition forall a . forall x:Tree a, mirror (mirror x) = x, and therefore a proof term also cannot be constructed. However, if you manage to express those trees at

[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

[Haskell-cafe] ANN: epoll bindings 0.2

2009-09-25 Thread Toralf Wittner
Hi, I am pleased to announce the release of epoll bindings 0.2 available from: http://hackage.haskell.org/package/epoll Epoll is an I/O event notification facility for Linux similar to poll but with good scaling characteristics. This release adds a buffer abstraction on top of the existing

Re: [Haskell-cafe] Proof in Haskell

2009-09-25 Thread Paul Johnson
One alternative approach is to use QuickCheck to test many trees and look for counter-examples. You can also use SmallCheck to do an exhaustive check up to a chosen size of tree. To do this with QuickCheck you would write a function such as prop_mirror :: Node a - Bool prop_mirror x =

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

[Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Warren Harris
I've dabbled in haskell, but am by no means an expert. I was hoping someone here could help me settle this debate so that we can more seriously consider haskell for a next version of an application we're building I would like to understand better what its capabilities are for

Re: [Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Don Stewart
warrensomebody: I've dabbled in haskell, but am by no means an expert. I was hoping someone here could help me settle this debate so that we can more seriously consider haskell for a next version of an application we're building I would like to understand better what its

Re: [Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Warren Harris
On Sep 25, 2009, at 12:14 PM, Don Stewart wrote: It is entirely possible to use mmap to map structures into memory. Thanks to the foreign function interface, there are well-defined semantics for calling to and from C. The key questions would be: * what is the type and representation of the

Re: [Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Don Stewart
warrensomebody: On Sep 25, 2009, at 12:14 PM, Don Stewart wrote: It is entirely possible to use mmap to map structures into memory. Thanks to the foreign function interface, there are well-defined semantics for calling to and from C. The key questions would be: * what is the type and

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

[Haskell-cafe] Re: Beginning of a meta-Haskell [was: An issue with the ``finally tagless'' tradition]

2009-09-25 Thread Brad Larsen
Oleg, On Thu, Sep 24, 2009 at 1:54 AM, o...@okmij.org wrote: The topic of an extensible, modular interpreter in the tagless final style has come up before. A bit more than a year ago, on a flight from Frankfurt to San Francisco I wrote two interpreters for a trivial subset of Haskell or ML

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] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-25 Thread wren ng thornton
Brad Larsen wrote: On Thu, Sep 24, 2009 at 8:36 PM, wren ng thornton w...@freegeek.org wrote: The reason this is unsatisfying is [...] if you need to lift more than one variable in the same class then it can be tricky to do the encoding right. For instance, when converting Monad into this form

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