Re: Yet Another Monad Tutorial

2003-08-15 Thread Lars Lundgren
On Thu, 14 Aug 2003, blaat blaat wrote: To many questions, not enough mail. First, thanks for all your replies. Second, I stand totally corrected on the fact that we cannot break down monads. Functions of type m a-b are called impure, Haskell is a pure language, so there are *no* impure

Re: Pure File Reading (was: Dealing with configuration data)

2002-09-26 Thread Lars Lundgren
On 26 Sep 2002, Yoann Padioleau wrote: Koen Claessen [EMAIL PROTECTED] writes: i find your idea very good. indeed for the library GetOpt, the argument of a program never change so it make sense to make this library without using IO monad, same for argv and for the enviroment. for

Re: Pure File Reading (was: Dealing with configuration data)

2002-09-26 Thread Lars Lundgren
On 26 Sep 2002, Yoann Padioleau wrote: Koen Claessen [EMAIL PROTECTED] writes: i find your idea very good. indeed for the library GetOpt, the argument of a program never change so it make sense to make this library without using IO monad, same for argv and for the enviroment. for

Re: monad binding and garbage collection

2002-01-17 Thread Lars Lundgren
On Thu, 17 Jan 2002, Christian Schuhegger wrote: buildIOList :: [a] - IO [a] buildIOList li = return li main = do {li - buildIOList [1..]; putStr (show (take 1 li)); } I take it you know that do li - buildIOList [1..] ... is equal to do

Re: Tree handling

2001-02-26 Thread Lars Lundgren
On Mon, 26 Feb 2001, Martin Gustafsson wrote: Hello I'm a haskell newbie that tries to create a tree with arbitary numbers of childs. I create the data structure but i can't do anything on it can someone please help me with a small function that sums the values of the leafs, so i dont

Re: unliftM

2001-02-22 Thread Lars Lundgren
On 23 Feb 2001, Julian Assange wrote: Is there a standard construct for something of this ilk: unliftM :: Monad m a - a I do not know if it is a standard, but every monad usually has a "runMonad" function. For ST you have runST, for IO you have unsafePerformIO and for your own monad

Re: Type class inference trouble

2001-02-19 Thread Lars Lundgren
On Sat, 17 Feb 2001, Ken Shan wrote: On 2001-02-16T09:52:41+0100, Lars Lundgren wrote: This is ad hoc overloading, and IMHO bad style, at least in haskell. As I understand it, haskell type classes were never intended to support this. Well, whether this is ad hoc overloading depends

Re: Learning Haskell and FP

2001-01-04 Thread Lars Lundgren
On Wed, 3 Jan 2001, Michael Zawrotny wrote: 1. How the #$!? do I read some data from a file. Good, I've got the data, now I can work on it. Nope, now I have an "IO thingie" whatever that is, but all of the standard functions want a regular "thingie" now what? I do not know if you

Re: class instance with nested types

2000-10-27 Thread Lars Lundgren
On Fri, 27 Oct 2000, Matthias Höchsmann wrote: Hello, I have the following problem: basic datatypes type Sequence a = [a] data Tree a = N a (Forest a) deriving (Ord,Eq,Show) type Forest a = Sequence (Tree a) i want to construct a class Xy class Xy s a where test :: s

Re: pronunciation of =

2000-10-18 Thread Lars Lundgren
On Wed, 18 Oct 2000, Scott Turner wrote: Is there a common way to pronounce "=" in discussions or when teaching? I've learned all my Haskell from printed/visual documents. How about 'bind'? and "" = 'then'. /Lars L ___ Haskell mailing list

Re: more detailed explanation about forall in Haskell

2000-05-19 Thread Lars Lundgren
On 19 May 2000, Ketil Malde wrote: Frank Atanassow [EMAIL PROTECTED] writes: I agree, and I think it's hopeless. This is my last message to the Haskell list on the subject. There is nothing Haskell-specific any longer about this discussion. Uh, I feel I'm a bit of a hobbyist on this

Re: more detailed explanation about forall in Haskell

2000-05-16 Thread Lars Lundgren
On Tue, 16 May 2000, Jan Brosius wrote: Ok I understand this isomorphism better. However this remark seems to be of no value to functional programmers. Why trying to mix terms( otr types) with relations ? What is a 'type' in your oppinion? Isn't a type a statement about pre- and

Re: more detailed explanation about forall in Haskell

2000-05-11 Thread Lars Lundgren
On Thu, 11 May 2000, Jan Brosius wrote: Marcin Kowalczyk wrote at Wed, May 10, 2000 7:54 PM : Types can be treated as logical formulas, according to the Curry-Howard isomorphism. Sorry, never heard of in logic. But perhaps you can explain. M H Sørensen and P Urzyczyn. Lectures on

Re: How to debug Haskell programs?

2000-04-26 Thread Lars Lundgren
On 26 Apr 2000, Friedrich Dominicus wrote: This question may sound a bit strange. I'll try to explain. I have written a piece of Haskell and found that I did not understand things. I tried to look what I got wrong and searched for a possibility to give me output. Now obvious is that Haskell

Re: openfile :: String - String

2000-04-26 Thread Lars Lundgren
On Wed, 26 Apr 2000, Hamilton Richards wrote: The Gofer prelude had a function openfile :: String - String which mapped file path names to strings containing the named files' contents. The Hugs98 Prelude doesn't seem to have anything like that function. Instead, it has things

Re: File handling

2000-03-27 Thread Lars Lundgren
On Sat, 25 Mar 2000, T. D. Stones wrote: Hello there I am A 3rd year student at Leicester Uni, and I am doing my project using Hugs 1.4. I've noticed that things like EOF What is it you want to do with EOF? (I need to read a file aha, so why dont you use readFile :: FilePath - IO

Re: your mail

2000-02-10 Thread Lars Lundgren
On Wed, 9 Feb 2000, Stefan Friedel wrote: Hi everybody, I have a problem. I'm new to haskell and I have to write a function that takes the following list and finds the average by using recursion and adding the numbers together. I'm completely STUCK! Thank you. sales :: Int - Float

Re: file manipulation

1999-12-06 Thread Lars Lundgren
On Mon, 6 Dec 1999, c_stanto wrote: here is my code and I am guess that the problem is that openFile returns an IO Handle and getContents takes just a Handle. How do I go about fixing this? module Main(main) where import IO main = putStrLn (getContents (openFile "./joseph.txt"

Re: OO in Haskell

1999-10-11 Thread Lars Lundgren
On Mon, 11 Oct 1999, Adrian Hey wrote: On Mon 11 Oct, Lars Lundgren wrote: I'm sure a lot of poeple have gotten this wrong. I would be surprised if not all the experienced haskellers has this view though. Probably so, but this view seems in complete contradiction to that of the Clean

Re: OO in Haskell

1999-10-11 Thread Lars Lundgren
On Fri, 8 Oct 1999, Adrian Hey wrote: On Fri 08 Oct, Lars Lundgren wrote: A value (IO a) *denotes* a program possibly interacting with the world. *That* program is of course not referentially transparent. A haskell program generating an (IO a) on the other hand *is* referetially

Re: OO in Haskell

1999-10-08 Thread Lars Lundgren
On Thu, 7 Oct 1999, Adrian Hey wrote: On Thu 07 Oct, Manuel M. T. Chakravarty wrote: Check out the type signatures of the `MVar'-related operations and you will find that they are all nicely encapsulated in the `IO' monad. This is true, but I think the point of contention is does the

Re: Haskell and Parallelism (was: What is a functional language?)

1999-09-29 Thread Lars Lundgren
On Tue, 28 Sep 1999, S. Alexander Jacobson wrote: My simple point is that claims about the correctness or incorrectness of the behavior of a function are incoherent outside the function's domain; that, as an language implementation matter, it is handy to make _|_ a member of all types is

RE: Haskell Wish list: library documentation

1999-09-16 Thread Lars Lundgren
On Thu, 16 Sep 1999, Lars Lundgren wrote: [snip] myProg:: StateMT IO Int myProg = return 5 main = do n - runSMT myProg print n I forgot to show something interesting in my first example, try this instead: myProg:: StateMT IO Int myProg = do lift $ putStrLn "Hello

Re: Haskell Wish list: library documentation

1999-09-09 Thread Lars Lundgren
On Thu, 9 Sep 1999, George Russell wrote: Here is my revised version of the documentation. Sorry I can't manage the pretty formatting: unzip :: [(a,b)] - ([a],[b]) - Description: unzip takes a list of pairs and returns a pair of lists. Examples: unzip [(1,2),(3,4),(5,6)]

Re: Wanted: Union-Find library for Haskell

1999-08-17 Thread Lars Lundgren
On Mon, 16 Aug 1999, Keith Wansbrough wrote: Hi all... has anyone implemented the Union-Find algorithm in Haskell? I've looked at the various libraries listed at haskell.org and found nothing, but don't want to re-invent the wheel if someone else has done it already. Hmm, yes I have

Re: Wanted: Union-Find library for Haskell

1999-08-17 Thread Lars Lundgren
On Mon, 16 Aug 1999, Keith Wansbrough wrote: Hi all... has anyone implemented the Union-Find algorithm in Haskell? I've looked at the various libraries listed at haskell.org and found nothing, but don't want to re-invent the wheel if someone else has done it already. Yes I have. I

Re: types

1999-06-14 Thread Lars Lundgren
On Mon, 14 Jun 1999, Jose Bernardo Barros wrote: According to the definition of the class Bounded, minBound and maxBound have types minBound :: Bounded a = a maxBound :: Bounded a = a Suppose I define the function f (minBound, maxBound) = (maxBound, minBound)

Re: how to write a simple cat

1999-06-10 Thread Lars Lundgren
On Wed, 9 Jun 1999, Friedrich Dominicus wrote: [snip] What's a HOF? A Higher Order Function, the key to code reuse and abstraction. that first splits something up to a list using splitFn (or with the generalization I mentioned, to a monad), then maps a function over that list (namely

Re: Haskell 2 -- Dependent types?

1999-02-17 Thread Lars Lundgren
On 16 Feb 1999, Carl R. Witty wrote: Lars Lundgren [EMAIL PROTECTED] writes: We have already accepted undecidable type checking, so why not take a big step forward, and gain expressive power of a new magnitude, by extending the type system to allow dependent types. Wait a minute

Haskell 2 -- Dependent types?

1999-02-16 Thread Lars Lundgren
The trend seems to be define wishes for haskell 2, so here are mine: We have already accepted undecidable type checking, so why not take a big step forward, and gain expressive power of a new magnitude, by extending the type system to allow dependent types. Cayenne,

Re: f :: IO x - x

1999-01-03 Thread Lars Lundgren
On Fri, 5 Nov 1999, Dusan Kolar wrote: Hi, Could anyone, please, give me reference to or a sophisticated answer? I am going to have maybe a very stupid question. Well. it's definitely a FAQ. Playing with IO monads I made to me a task. Create a function which counts lines of a