Re: [Haskell-cafe] IO and State

2004-11-12 Thread Iavor S. Diatchki
Hello, I see now what you meant, thanks for the explanation. I find the argument a bit disturbing, as it seems to imply that it is OK for the compiler to produce code without any context switches at all (after all none of the context swicthes are guaranteed to happen :-). I guess this is not true

Re: [Haskell-cafe] IO and State

2004-11-12 Thread Iavor S. Diatchki
Hello, Ben Rudiak-Gould wrote: ... I would say that the law holds in one direction and not the other. It's safe to replace do x <- readSTRef r y <- readSTRef r with do x <- readSTRef r let y = x but not the other way around. How can things be equal the one way and not the other?

Re: [Haskell-cafe] IO and State

2004-11-10 Thread Iavor S. Diatchki
lWorld", and so the computation could not be runSTed. -Iavor Graham Klyne wrote: At 10:38 08/11/04 -0800, Iavor S. Diatchki wrote: ... Now the above law already doesn't hold when all GHC extensions are used, as when concurrency is present we cannot assume that nobody modified

[Haskell-cafe] IO and State (was Re: [Haskell] Re: Global Variables and IO initializers)

2004-11-08 Thread Iavor S. Diatchki
Hello, Just wanted to point out that the suggested idea is not quite correct. (well that has to be quantiifed a bit, see bellow) Krasimir Angelov wrote: --- Ben Rudiak-Gould <[EMAIL PROTECTED]> wrote: This is solved by merging the IO and ST monads, something that ought to be done anyway: ty

Re: [Haskell-cafe] Optmiization of recursion

2004-09-28 Thread Iavor S. Diatchki
hello, John Goerzen wrote: Hello, As I'm investigating Haskell, it's occured to me that most of the Haskell tutorials out there have omitted something that was quite prominent in the OCaml material I had read: making functions properly tail-recursive. The OCaml compiler was able to optimize tail-re

Re: [Haskell-cafe] Lifting makes lazy

2004-09-16 Thread Iavor S. Diatchki
hello, the types IO(IO ()) and IO() are not the same. think of a value of type "IO a" as a _program_ that when executed will return a result of type "a" (and while executing may print some stuff to the screen). now consider these types: putStrLn :: String -> IO () this is a _pure function_ which

Re: [Haskell-cafe] complete documentation like the one from Java or C++

2004-09-10 Thread Iavor S. Diatchki
hello, Fergus Henderson wrote: On 10-Sep-2004, Cale Gibbard <[EMAIL PROTECTED]> wrote: Just in case it's not what you're referring to, http://www.haskell.org/ghc/docs/latest/html/libraries/index.html together with the Haskell report http://www.haskell.org/onlinereport/ generally does the trick

Re: [Haskell-cafe] Relating functors in Category Theory to Functor

2004-07-02 Thread Iavor S. Diatchki
hello, i was thinking of higher-order functions, which i think complicate things (i might be wrong though :-) for example: fix :: (a -> a) -> a is ploymorphic, but is it a natural tranformation? i belive it is in fact a di-natural transformation. -iavor On Jun 29, 2004, at 6:46 PM, I

Re: [Haskell-cafe] Relating functors in Category Theory to Functor

2004-06-29 Thread Iavor S. Diatchki
hi, just a few silly remarks... [EMAIL PROTECTED] wrote: For two functors F, G: C -> D, there is a natural transformation tau from F to G, if for every object a in C, there is morphism tau[a]: F(a) -> G(a) in D. In Haskell, natural transformations are polymorphic functions, tau :: f a -> g a. For e

[Haskell-cafe] Re: (to haskell-cafe) comment on language shootout

2004-06-18 Thread Iavor S. Diatchki
hello, Greg Morrisett wrote: Iavor S. Diatchki wrote: what would be cool is to have a place where one has many versions of the same program, but each written in the "most natural" way for the particular language --- a kind of "rosetta stone" for programming languages.

Re: [Haskell-cafe] Modules and files

2004-06-14 Thread Iavor S. Diatchki
hello, according to the report there should be no connection between modules and files, and one should be able to have multiple modules in a file, and even a single module in multiple files. however none of the implementations support that, so in effect there is 1-1 correspondence between modules

Re: [Haskell-cafe] Join and it's relation to >>= and return

2004-06-08 Thread Iavor S. Diatchki
hi ron, here are the relations between the two formulations of monads: (using haskell notation) map f m = m >>= (return . f) join m = m >>= id m >>= f = join (fmap f m) there are quite a few general concepts that you need to understand in what sense monads are monoids, but to unde

Re: [Haskell-cafe] Data constructors

2004-04-26 Thread Iavor S. Diatchki
hi, i have thought about things like that, but the qualification Type.Constructor does not seem particularly useful. you can achieve the same by using "_", e.g data A = A_X | A_Y data B = B_X | B_Y alternatively (at least for non-recursilve datatypes) anonymous sums (ala TREX's records) could wo

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-06 Thread Iavor S. Diatchki
hello, this is an attempt to give an answer to someone who is new to Haskell. the answer to your question is: no, there is no way to "catch" _|_, as that would mean that we can solve the halting problem. a piece of advice, especially while you are new to haskell --- don't worry too much about _|_.

Re: [Haskell-cafe] State Monad

2004-03-03 Thread Iavor S. Diatchki
ork with computations that manipulate state, but can also raise exceptions? -iavor -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OH

Re: [Haskell-cafe] Type Class Query

2004-02-03 Thread Iavor S. Diatchki
type constructor" instead of just a "constructor" in its error message? Or perhaps it could simply say "type"? -kzm -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and

Re: [Haskell-cafe] Puzzled by error with forall quantifier.

2004-02-02 Thread Iavor S. Diatchki
type v -> (t->t) -> (w->w) for some type w of class Space. Any help much appreciated. Is there any kind of tutorial introduction to "forall" out there? Cheers, Theo Norvell ___ Haskell-Cafe mailing list [EMAIL PRO

bugs from n+k patterns (was: Re: Preventing/handling space leaks)

2003-12-11 Thread Iavor S. Diatchki
atterns been made obsolete? -iavor -- ========== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU |

Re: Preventing/handling space leaks

2003-12-10 Thread Iavor S. Diatchki
with its behaviour, or one can make the code lazy, but then is some situations it will leak. just my 2 stotinki. iavor -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at

Re: what's the deal with "user error" on fail?

2003-11-13 Thread Iavor S. Diatchki
fe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering |

Re: what's the deal with "user error" on fail?

2003-11-13 Thread Iavor S. Diatchki
r opening file" The user gets a message like Fail: user error Reason: Error opening file which is confusing to the user, because it the user's fault. Is there some other way that it is recommended one fail? Or should I be catching userErrors at the top level and failing with my own erro

Re: Beginner help

2003-02-11 Thread Iavor S. Diatchki
(4 - 0))) foldl groups things to the left, while foldr groups them to the right. hope this helped bye iavor -- ========== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU

separate compilation [was Re: Global variables?]

2003-02-05 Thread Iavor S. Diatchki
fact we have it implemented in one of the projects i am currently working on. hopefully one day GHC will also dispense with the hi-boot files. bye iavor -- ====== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science an

Re: Stacking up state transformers

2003-02-04 Thread Iavor S. Diatchki
ormers, one that comes to mind is "Monad Transformers and Modular Interpreters" by Sheng Liang, Paul Hudak, and Mark P. Jones hope this helped bye iavor -- == | Iavor S. Diatchki, Ph.D. student | | Department of Computer Sci

Implicit params [was Re: Record of STRefs better than STRef to a Record?]

2002-11-14 Thread Iavor S. Diatchki
ation for computations in the environment monad, so in my mind the above two definitions are pretty much the same. bye iavor -- ====== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | Sch

Re: mutable records

2002-09-09 Thread Iavor S. Diatchki
ll module system. unfortunatelly with the Haskell module system approach you soon run into recursive modules (when objects depend on each other) and this is not well supported by Haskell implementations at the moment. bye iavor -- ====== | Iavor S. Diatchk

Re: mutable records

2002-09-03 Thread Iavor S. Diatchki
of the records in the list actually matters. bye iavor -- ========== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http:

Re: Reasons behind the "one instance per type" limitation

2001-10-09 Thread Iavor S. Diatchki
rkshop i think). bye iavor -- ========== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http: