Re: [Haskell] I repeat my Question becaue I not really sure to do it right

2016-08-28 Thread Ivan Lazar Miljenovic
On 28 August 2016 at 22:40, wrote: > This is Leksah http://leksah.org/ > Please excuse my false name for it > And the Question is why can I install it. What error messages do you have when you try? From here, this is what you need to do: https://github.com/leksah/leksah/wiki/download

Re: [Haskell] I repeat my Question becaue I not really sure to do it right

2016-08-28 Thread CCUTM
This is Leksah http://leksah.org/ Please excuse my false name for it And the Question is why can I install it.   excuse me. Mungo1981   Gesendet: Sonntag, 28. August 2016 um 13:49 Uhr Von: "Ivan Lazar Miljenovic" An: cc...@web.de Cc: "Haskell List" Betreff: Re: [

Re: [Haskell] I repeat my Question becaue I not really sure to do it right

2016-08-28 Thread Ivan Lazar Miljenovic
On 28 August 2016 at 20:43, wrote: > Ok Haskell is good. > Ok Laska is great. > And my Ubuntu Studio ist rubish > So I try to install Laska on Ubuntu Studio > But when I do this, i will get a long list of dependecies > which could not reallise > So I not know what should

[Haskell] I repeat my Question becaue I not really sure to do it right

2016-08-28 Thread CCUTM
Ok Haskell is good. Ok Laska is great. And my Ubuntu Studio ist rubish So I try to install Laska on Ubuntu Studio But when I do this, i will get a long list of dependecies which could not reallise So I not know what should I do   Mungo1981 ___ Has

Re: [Haskell] Beginner - Binary Search Tree Question

2011-02-12 Thread Tillmann Rendel
a c) = 1 + numLeaves c numLeaves (Node b a EmptyBST) = 1 + numLeaves c numLeaves (Node b a c) = numLeaves b + numLeaves c By the way, you might want to think about the following question: Is it really necessary to handle empty trees in the case for non-empty trees, or can the recu

Re: [Haskell] Beginner - Binary Search Tree Question

2011-02-12 Thread htc2011
Wow, this was a fast reply :-) Thank you Mihai! This works. -- View this message in context: http://haskell.1045720.n5.nabble.com/Beginner-Binary-Search-Tree-Question-tp3382548p3382554.html Sent from the Haskell - Haskell mailing list archive at Nabble.com

Re: [Haskell] Beginner - Binary Search Tree Question

2011-02-12 Thread Benjamin Jakobus
Wow, this was a fast reply :-) Thank you Mihai! This works. On 12 February 2011 10:45, Mihai Maruseac wrote: > On Sat, Feb 12, 2011 at 12:39 PM, htc2011 wrote: > > > > Hi All, > > > > I am learning Haskell and can't understand the following problem. Maybe > > somebody could advise me on a solut

Re: [Haskell] Beginner - Binary Search Tree Question

2011-02-12 Thread Mihai Maruseac
On Sat, Feb 12, 2011 at 12:39 PM, htc2011 wrote: > > Hi All, > > I am learning Haskell and can't understand the following problem. Maybe > somebody could advise me on a solution? > > Using GHCI, I have the following definition of a BST: > data Ord a => BST a = EmptyBST | Node ( BST a ) a ( BST a )

[Haskell] Beginner - Binary Search Tree Question

2011-02-12 Thread htc2011
.nabble.com/Beginner-Binary-Search-Tree-Question-tp3382548p3382548.html Sent from the Haskell - Haskell mailing list archive at Nabble.com. ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] a quick question

2011-02-03 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2/2/11 22:01 , Ramy Abdel-Azim wrote: > No need to apologize. Not dumb of you. The mandatory else is unusual. I > don't personally know of any other language that requires an else for every > if. Haskell's if is an expression, best compared to the

Re: [Haskell] a quick question

2011-02-03 Thread malcolm.wallace
Can I suggest you take this discussion to either the haskell-beginners list, or haskell-cafe?This list (haskell@haskell.org) is intended primarily for announcements.Regards, MalcolmOn 03 Feb, 2011,at 09:33 AM, Matthias Görgens wrote:> uptable::[[Char]]->[([Char],Int,Int,Int,Int)]->[([Char],Int

Re: [Haskell] a quick question

2011-02-03 Thread Matthias Görgens
> uptable::[[Char]]->[([Char],Int,Int,Int,Int)]->[([Char],Int,Int,Int,Int)] > uptable (xf:xs) main_array = map (\(x,y,z,r,t)-> do if x==xf then tupup x y > z r t second xs ) main_array Why do you have a `do' in that snippet? ___ Haskell mailing list Has

Re: [Haskell] a quick question

2011-02-02 Thread Julian Gilbey
On Wed, Feb 02, 2011 at 10:01:08PM -0500, Ramy Abdel-Azim wrote: > No need to apologize. Not dumb of you. The mandatory else is unusual. I > don't personally know of any other language that requires an else for every > if. Indeed. Haskell's if ... then ... else ... is akin to C's ... ? ... : ...

Re: [Haskell] a quick question

2011-02-02 Thread Ramy Abdel-Azim
thanks, > Navin > -- > *From:* Ramy Abdel-Azim > *To:* Navin Rustagi > *Cc:* Haskell@haskell.org > *Sent:* Wed, February 2, 2011 7:55:09 PM > *Subject:* Re: [Haskell] a quick question > > Missing else? > > On Wed, Feb 2, 2011 at 8:49 PM, Navin Rustagi w

Re: [Haskell] a quick question

2011-02-02 Thread Navin Rustagi
Sorry, dumb of me doesn't give this error anymore. thanks, Navin From: Ramy Abdel-Azim To: Navin Rustagi Cc: Haskell@haskell.org Sent: Wed, February 2, 2011 7:55:09 PM Subject: Re: [Haskell] a quick question Missing else? On Wed, Feb 2, 2011 at 8:

Re: [Haskell] a quick question

2011-02-02 Thread Ramy Abdel-Azim
Missing else? On Wed, Feb 2, 2011 at 8:49 PM, Navin Rustagi wrote: > Hi all, > > I am stuck at a piece of code and am not able to figure out the error. > > > uptable::[[Char]]->[([Char],Int,Int,Int,Int)]->[([Char],Int,Int,Int,Int)] > uptable (xf:xs) main_array = map (\(x,y,z,r,t)-> do if x==xf t

[Haskell] a quick question

2011-02-02 Thread Navin Rustagi
Hi all, I am stuck at a piece of code and am not able to figure out the error. uptable::[[Char]]->[([Char],Int,Int,Int,Int)]->[([Char],Int,Int,Int,Int)] uptable (xf:xs) main_array = map (\(x,y,z,r,t)-> do if x==xf then tupup x y z r t second xs ) main_array here tupup and second are functi

Re: [Haskell] Pearls of Functional Algorithm Design question

2011-01-03 Thread Mark Engelberg
Richard sent me a note offlist which quickly cleared up my misconception. I was mistaken that table could contain n^2 elements. A closer reading of the definition of table makes it clear that it will have n elements, so the n log n bound makes perfect sense to me now. Thanks! --Mark P.S. I hig

[Haskell] Pearls of Functional Algorithm Design question

2011-01-02 Thread Mark Engelberg
I'm currently reading the excellent Haskell-based book "Pearls of Functional Algorithm Design".  I have a question about Chapter 2, the "surpassing problem". According to the book, "since join takes linear time, table is computer in O(n log n) steps". Howeve

[Haskell] Fwd: [Haskell-cafe] Question about memory usage

2010-08-16 Thread Alberto G. Corona
It is not repeated because fiblist is pure and has no arguments. Otherwise it would be repeated. 2010/8/14 Tako Schotanus > I was reading this article: > > http://scienceblogs.com/goodmath/2009/11/writing_basic_functions_in_has.php > > And came to the part where it shows: > > > > fiblist = 0 :

Re: [Haskell] Monads Terminology Question

2010-04-11 Thread Bernie Pope
On 12 April 2010 10:39, Mark Snyder wrote: >     I'm wondering what the correct terminology is for the extra functions > that we define with monads.  For instance, State has get and put, Reader has > ask and local, etc.  Is there a good name for these?  I've been calling them > the "non-proper mor

Re: [Haskell] Monads Terminology Question

2010-04-11 Thread Tony Morris
I think these names are specific to each data type (which happens to be a monad) so unless they generalise, then they are not deserving of any special terminology than any other functions. While State and Reader are both Monads, they are also many other things such as Functor and Applicative (and

[Haskell] Monads Terminology Question

2010-04-11 Thread Mark Snyder
Hello, I'm wondering what the correct terminology is for the extra functions that we define with monads. For instance, State has get and put, Reader has ask and local, etc. Is there a good name for these? I've been calling them the "non-proper morphisms" (as opposed to the "proper" morph

Re: [Haskell] Question concerning the "Data Parallel Haskell: a status report" paper

2008-01-07 Thread Roman Leshchinskiy
Stephan Friedrichs wrote: class ArrElem Int where -- sic! -- ... My question is: Is "class ArrElem Int" a typo and should be "instance ArrElem Int" or did I get something wrong? Yes, that's a typo. Thanks fo

Re: [Haskell] Question concerning the "Data Parallel Haskell: a status report" paper

2008-01-07 Thread Brent Yorgey
s an important source of > my seminar handout about skeletons and parallelisation. It contains code > samples concerning the ArrElem type family: > > class ArrElem e where >data [:e:] >(!:) :: [:e:] -> Int -> e > > and various instance declarations, e.g.:

[Haskell] Question concerning the "Data Parallel Haskell: a status report" paper

2008-01-05 Thread Stephan Friedrichs
erning the ArrElem type family: class ArrElem e where data [:e:] (!:) :: [:e:] -> Int -> e and various instance declarations, e.g.: class ArrElem Int where -- sic! -- ... My question is: Is "class ArrElem Int" a typo and should be "instance ArrElem In

Re: [Haskell] Module system question

2007-10-16 Thread John Meacham
On Mon, Oct 15, 2007 at 10:34:37PM +0300, Iavor Diatchki wrote: > I like the Hugs behavior because it accepts more programs. OTOH, > GHC's behavior may be a bit simpler to explain and implement(?). Any > thoughts? Currently, the class and datatype namespaces are considered the same by the stand

Re: [Haskell] Module system question

2007-10-16 Thread Iavor Diatchki
Hello, On 10/16/07, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > The H98 report is pretty clear about there being a single name space for type > constructors and classes. Yes, in certain circumstances it's unambiguous. > In Hugs, can you write > module M where > class C a

RE: [Haskell] Module system question

2007-10-16 Thread Simon Peyton-Jones
ich is also unambiguous. I'm inclined to stick to the H98 story. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iavor Diatchki | Sent: 15 October 2007 20:35 | To: haskell@haskell.org | Subject: [Haskell] Module system question | | Hello, | | I

[Haskell] Module system question

2007-10-15 Thread Iavor Diatchki
Hello, I have a question concerning Haskell's module system. Consider the following example which defines three modules A,B, and C: > module A where { data X = X } > module B where { class X a } > module C where { import A; import B; data Y = Y X } The question is: "Is there

Re: [Haskell] question about a failure to generalize

2007-09-17 Thread Norman Ramsey
> If so, try working around the monomorphism restriction by changing > from a pattern binding to a function binding. > > fold f = foldRegsUsed f Brilliant. I hadn't known about the monomorphism restriction. Now I know it's a 'necessary evil'. Thanks! Norman

Re: [Haskell] Blocked STM & GC question

2007-09-17 Thread Simon Marlow
Ashley Yakeley wrote: If I have a thread that's blocked on an STM retry or TChan read, and none of its TVars are referenced elsewhere, will it get stopped and garbage-collected? I have in mind a pump thread that eternally reads off a TChan and pushes the result to some function. If the TChan

Re: [Haskell] question about a failure to generalize

2007-09-16 Thread Tom Pledger
d by top-level-or-not, see sections 4.5.1 and 4.5.5 in the Haskell 98 Language and Libraries Report. Stefan Aargh! Sorry, I'm having a Bad Details Day. 3 in 1 message: - Overlooking the "to make the code work, I had to expand 'fold' into 'foldRegsUsed' every

Re: [Haskell] question about a failure to generalize

2007-09-16 Thread Stefan O'Rear
On Mon, Sep 17, 2007 at 04:15:10PM +1200, Tom Pledger wrote: > Norman Ramsey wrote: > : > | This code fails to compile because the compiler is willing to > | use 'fold' at only one type (CmmExpr as it happens) > : > > When it failed to compile, was > > fold = foldRegsUsed > > a top-level de

[Haskell] question about a failure to generalize

2007-09-16 Thread Tom Pledger
Norman Ramsey wrote: : | This code fails to compile because the compiler is willing to | use 'fold' at only one type (CmmExpr as it happens) : When it failed to compile, was fold = foldRegsUsed a top-level declaration in the module, rather than local to foldRegsUsed? If so, try working

[Haskell] question about a failure to generalize

2007-09-15 Thread Norman Ramsey
Dear Haskellers, I've had a Haskell program rejected for reasons I don't understand. Here's the relevant bit of code; the problem is that I expected the type-inference engine to generalize the abbreviation 'fold' to an overloaded function, but it doesn't---to make the code work, I had to expand 'f

[Haskell] Blocked STM & GC question

2007-09-15 Thread Ashley Yakeley
If I have a thread that's blocked on an STM retry or TChan read, and none of its TVars are referenced elsewhere, will it get stopped and garbage-collected? I have in mind a pump thread that eternally reads off a TChan and pushes the result to some function. If the TChan is forgotten elsewhere,

Re: [Haskell] not-so-newbie question

2007-05-20 Thread Taral
Also note that this will install ghc into the underlying unix environment. If you want a pretty GUI, I don't know of any for Mac OS X. A quick search on google for "mac haskell ide" brings up http://www.hoovy.org/HaskellXcodePlugin/ -- this might help you. I will note that if you are developing a

Re: [Haskell] not-so-newbie question

2007-05-20 Thread Taral
You need to install Xcode (from your Mac OS disk) before you can use ghc. On 5/20/07, Wolfgang De Meuter <[EMAIL PROTECTED]> wrote: Exactly what I mean. When you download and unpack the file you get a unix folder with install stuff. After trying to follow the installation instructions, it compla

Re: [Haskell] not-so-newbie question

2007-05-20 Thread Wolfgang De Meuter
Exactly what I mean. When you download and unpack the file you get a unix folder with install stuff. After trying to follow the installation instructions, it complains that I don't have a gcc on my machine... Wolf On 20-mei-07, at 22:41, Tom Harper wrote: http://haskell.org/ghc/download_

Re: [Haskell] not-so-newbie question

2007-05-20 Thread Tom Harper
http://haskell.org/ghc/download_ghc_661.html#macosxppc On 5/20/07, Wolfgang De Meuter <[EMAIL PROTECTED]> wrote: Dear all, I used to be a Gofer freak on my Mac back in the mid-nineties. Recently I have regained interest in FP and I'm trying to get hold of an implementation of Haskell on my G4.

[Haskell] not-so-newbie question

2007-05-20 Thread Wolfgang De Meuter
Dear all, I used to be a Gofer freak on my Mac back in the mid-nineties. Recently I have regained interest in FP and I'm trying to get hold of an implementation of Haskell on my G4. I must say that this hunt has been quite frustrating until now. I don't know unix and I'm unwilling to lear

[Haskell] haskell question

2007-04-18 Thread Greg Meredith
Haskellians, In the attached file i have implemented the bare bones core of the syntax -- pre structural equivalence -- of Milner's presentation of \pi via abstractions and concretions. (There's a minor twist in that the notion of location affords more structure than in Milner's original presenta

[Haskell] A question about a possible bug in GHC regarding GADTs and type classes

2007-01-17 Thread Pablo Nogueira
Hi, I've been told the following short code is correct but it's GHC's fault it does not type check. Is that the case? -- {-# OPTIONS -fglasgow-exts #-} -- An expression GADT: data Exp :: * -> * where LitNum :: Num a => a -> Exp a LitBool :: Bool -> Exp Bool Plus :: Num a => Exp a ->

Re: [Haskell] Haskell 98 syntax question

2007-01-10 Thread Wolfgang Lux
Sascha Böhme wrote: Hello, referring to the Haskell 98 report as available in the Internet, I have a short question. Section 4.1.3 (Syntax of Class Assertions and Contexts) contains the rule: class -> qtycls tyvar | qtycls ( tyvar atype1 ... atypen ) (n>=1) Is there a (

Re: [Haskell] Haskell 98 syntax question

2007-01-10 Thread Stefan O'Rear
On Wed, Jan 10, 2007 at 03:33:44PM +0100, "Sascha B?hme" wrote: > Hello, > > referring to the Haskell 98 report as available in the Internet, I have a > short question. Section 4.1.3 (Syntax of Class Assertions and Contexts) > contains the rule: > > class -&

[Haskell] Haskell 98 syntax question

2007-01-10 Thread Sascha Böhme
Hello, referring to the Haskell 98 report as available in the Internet, I have a short question. Section 4.1.3 (Syntax of Class Assertions and Contexts) contains the rule: class -> qtycls tyvar | qtycls ( tyvar atype1 ... atypen ) (n>=1) Is there a (simple) practical exampl

Re: [Haskell] Fast Packed Strings Question

2007-01-07 Thread Brandon S. Allbery KF8NH
On Jan 7, 2007, at 14:30 , Dominic Steinitz wrote: Data/Digest/SHA1.hs:36:17: Could not find module `Data.ByteString': it was found in multiple packages: fps-0.8 base What's the story with fast packed strings these days? Is it now part of base and I shouldn't have installed it? If not

[Haskell] Fast Packed Strings Question

2007-01-07 Thread Dominic Steinitz
After a lay off from Haskell for a few months and preparatory to Hac 07, I thought I had better check my laptop was appropriately set up. However, I encountered the following: C:\Documents and Settings\Owner\crypto>Setup build Preprocessing library Crypto-3.1.0... Preprocessing executables for

Re: [Haskell] Re: GHC Error question

2006-12-07 Thread Norman Ramsey
> The analogous declaration in *Standard* ML, which gets this right, is > > fun 'a foo (x:'a) y = (x + 1, (y:'a)) Following up my own post, I thought it might be kind to explain the arcana of the SML syntax. The explicit 'a between 'fun' and 'foo' is SML syntax for an explicit type-lambda (

[Haskell] Re: GHC Error question

2006-12-07 Thread Norman Ramsey
> Regarding the quantification: in ML (OCaml) we can write > let foo (x:'a) y = (x+1,(y:'a)) > That does not mean that foo has the type forall 'a. 'a -> 'a -> ... Type annotations in OCaml are completely broken and always have been. They use 'unifies with' instead of 'is an instance of' an

Re: [Haskell] Re: GHC Error question

2006-12-06 Thread rossberg
[EMAIL PROTECTED] wrote: > > I'm afraid I may disagree about the quantification. Also, I'm cautious > about the phrase "ML and Haskell". In GHC 6.4, local type variables > behave pretty much like those in ML (actually, GHC 6.2 was closer). In > GHC 6.6, the behavior is completely different! > > Reg

[Haskell] Re: GHC Error question

2006-12-06 Thread oleg
> > Or, one may use the local type variable to the same end > > > > > compile1 :: forall b t box. (Builder b box) => t -> Name -> Ir.ANF -> b > > > t compile1 f x body = do env <- compile body empty > > > wire ((Arg W)::Source box) (env x) > > >

[Haskell] Re: GHC Error question

2006-12-06 Thread Norman Ramsey
> Norman Ramsey wrote: > > > compile1 :: (Builder b box) => t -> Name -> Ir.ANF -> b t > > compile1 f x body = do env <- compile body empty > > wire (Arg W) (env x) > > return f > > class (Monad b) => Builder b box where > > wire

[Haskell] Re: GHC Error question

2006-12-05 Thread oleg
Norman Ramsey wrote: > compile1 :: (Builder b box) => t -> Name -> Ir.ANF -> b t > compile1 f x body = do env <- compile body empty > wire (Arg W) (env x) > return f > class (Monad b) => Builder b box where > wire:: Source bo

[Haskell] GHC Error question

2006-12-05 Thread Norman Ramsey
Without going too deep into the details of my type classes, I have written the following code (focusing on compile1): {-# OPTIONS -fglasgow-exts #-} compile1 :: (Builder b box) => t -> Name -> Ir.ANF -> b t compile1 f x body = do env <- compile body empty wire (Arg

[Haskell] RE: Safe forking question

2006-12-04 Thread Simon Marlow
[ duh, hit send by mistake, message continues... ] Chris Kuklewicz wrote: > forkInheritIO :: IO () -> IO ThreadId -- inherits parent's > block or unblock status > > forkBlockedIO :: IO () -> IO ThreadId -- starts the action in > "block" mode. Must manually "unblock" > Either of these is certain

[Haskell] RE: Safe forking question

2006-12-04 Thread Simon Marlow
Chris Kuklewicz wrote: > forkInheritIO :: IO () -> IO ThreadId -- inherits parent's > block or unblock status > > forkBlockedIO :: IO () -> IO ThreadId -- starts the action in > "block" mode. Must manually "unblock" > Either of these is certainly possible, and I agree that forkBlockedIO is more

[Haskell] Re: Safe forking question

2006-12-04 Thread Chris Kuklewicz
Hi, Thanks for the reply. I have my own proposal below: Simon Marlow wrote: > Chris Kuklewicz wrote: >> In response to question by Cat Dancer <[EMAIL PROTECTED]> I wrote a few >> tests of >> sending asynchronous signal to a thread using GHC 6.6 >> >>

[Haskell] Re: Safe forking question

2006-12-04 Thread Simon Marlow
Chris Kuklewicz wrote: In response to question by Cat Dancer <[EMAIL PROTECTED]> I wrote a few tests of sending asynchronous signal to a thread using GHC 6.6 The goal was to run a child thread via forkIO and use handle or finally to respond to the thread's demise. Unfortunately, it

[Haskell] Safe forking question

2006-12-03 Thread Chris Kuklewicz
In response to question by Cat Dancer <[EMAIL PROTECTED]> I wrote a few tests of sending asynchronous signal to a thread using GHC 6.6 The goal was to run a child thread via forkIO and use handle or finally to respond to the thread's demise. Unfortunately, it seems that there is an

[Haskell] Re: Monad transformer question

2006-10-26 Thread apfelmus
Cyril Schmidt wrote: > Working on a Monte-Carlo simulation where I have to > calculate the values of a certain function on the given set of inputs, > I noticed that some of the input variables change for every iteration, > while others do not. > > To give a simple example, let's suppose I have a f

Re: [Haskell] Monad transformer question

2006-10-25 Thread Chris Kuklewicz
. >>results = map (runReader reader) [ Inner { p1 = x } | x <- [0..9] ] >>putStrLn $ "a1 = "++show a1++", a2= "++show a2++", results = " >> ++show results > > > However similar they look, f and f' have ver

Re: [Haskell] Monad transformer question

2006-10-25 Thread Cyril Schmidt
Lajos, Point taken, thanks. My question, though, is not as much about how I speed up my program, as it is about the behaviour of the ReaderT monad transformer. There is something I do not understand about it, namely, why does such a small change in the code change the behaviour so much. Regards

[Haskell] Monad transformer question

2006-10-25 Thread Cyril Schmidt
lc is invoked 40 times, which means that all the benefits of pre-calculating (a1*a2) are gone. (In the real application, I pre-calculate a much more complicated and expensive expression, that's why it matters). I am curious why this happens. As far as I can see, the lift function of ReaderT is the sa

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread John Meacham
On Tue, Feb 21, 2006 at 11:04:40PM +, Simon Marlow wrote: > Your drop__ reminds me of GHC's touch#, which is like drop__ in the IO > monad. We use it to control lifetimes, eg. inside withForeignPtr. You > could implement drop in terms of touch#: > >drop__ a b = case touch# a realworld#

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread Simon Marlow
John Meacham wrote: On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote: John Meacham <[EMAIL PROTECTED]> wrote: I generalized this primitive to drop__ :: a -> b -> b Also known in the Prelude as "const"... well, 'flip const' but yes. The difference is that you propose

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread John Meacham
On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote: > John Meacham <[EMAIL PROTECTED]> wrote: > > > I generalized this primitive to > > > > drop__ :: a -> b -> b > > Also known in the Prelude as "const"... well, 'flip const' but yes. > The difference is that you propose it be pri

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread Malcolm Wallace
John Meacham <[EMAIL PROTECTED]> wrote: > I generalized this primitive to > > drop__ :: a -> b -> b Also known in the Prelude as "const"... The difference is that you propose it be primitive, with the intention that a clever compiler should not be able to bypass it by inlining its definition a

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-20 Thread John Meacham
After reading all the interesting responses I decided to go with a slight generalization of my original idea, and it surprisingly turns out to have other generally useful unintended uses, which is the point that a 'hack' becomes a 'feature'. :) before I had a primitive: newWorld__ :: a -> World__

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-20 Thread Simon Marlow
John Meacham wrote: So, I finally decided that jhc needs real arrays, but am running into an issue and was wondering how other compilers solve it, or if there is a general accepted way to do so. here is what I have so far -- The opaque internal array type data Array__ a -- the array transform

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-16 Thread Ben Rudiak-Gould
Data.Array.ST has runSTArray :: Ix i => (forall s . ST s (STArray s i e)) -> Array i e I think if you can implement that, then all your problems will be solved. -- Ben ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/list

Re: [Haskell] Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-16 Thread Jan-Willem Maessen
On Feb 15, 2006, at 10:53 PM, John Meacham wrote: So, I finally decided that jhc needs real arrays, but am running into an issue and was wondering how other compilers solve it, or if there is a general accepted way to do so. ... now, the problem occurs in newAT__ newAT__ :: Int -> AT a -> A

Re: [Haskell] Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-15 Thread Taral
On 2/15/06, John Meacham <[EMAIL PROTECTED]> wrote: > > foreign import primitive "prim_newWorld__" :: forall a . a -> World__ > > which will throw away its argument and produce a World__. but since it > is primtive, the compiler will assume the world it returns might depend > on its argument. then

[Haskell] Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-15 Thread John Meacham
So, I finally decided that jhc needs real arrays, but am running into an issue and was wondering how other compilers solve it, or if there is a general accepted way to do so. here is what I have so far > -- The opaque internal array type > data Array__ a > > -- the array transformer quasi-monad >

Re: [Haskell] Boxing (Day) Question

2006-01-04 Thread John Meacham
On Mon, Dec 26, 2005 at 06:45:09PM +0100, Niklas Sorensson wrote: > That's what I thought. But I'm still curious when it is used, and why > it isn't a suitable solution for unboxed polymorhic functions in most > cases. I always thought A nice extension would be to allow polymorphic functions that

[Haskell] Re: Boxing (Day) Question

2005-12-29 Thread Ashley Yakeley
In article <[EMAIL PROTECTED] ft.com>, "Simon Peyton-Jones" <[EMAIL PROTECTED]> wrote: > The .NET CLR lifts the restriction by specialising code, so that it can > adapt to whether it is moving Int# or Double# values around. In > Haskell, though, it's not possible to statically generate all the

Re: [Haskell] A question about fundeps <-> GADT interaction

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 12:39:01PM +, Bruno Oliveira wrote: > A second alternative would be to simulate your GADT with a type class and > your constructors with the functions of that type class: > > [...] > > As a remark, this is a church encoding of the GADT. > > [...] > > Now you can encode

RE: [Haskell] A question about fundeps <-> GADT interaction

2005-12-29 Thread Bruno Oliveira
Hello Tomasz, Unfortunatelly I have only seen your message after Simon answered to it. I am sorry for the late answer! >| If there is another way to do this right now (conveniently, Oleg! ;-), >I >| would be more than happy to hear about it. >| >| If this worked, it would be a cool trick and a n

Re: [Haskell] A question about fundeps <-> GADT interaction

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 09:48:04AM -, Simon Peyton-Jones wrote: > Intriguing! I'm afraid it'll be some time before your code works, > though. No problem, I can wait. > First I have to get GADTs and type classes to play together nicely, > which I am hoping to do during Jan/Feb. Then I'll hav

RE: [Haskell] A question about fundeps <-> GADT interaction

2005-12-29 Thread Simon Peyton-Jones
if it works at all, it's quite amazing. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tomasz | Zielonka | Sent: 22 December 2005 14:16 | To: Haskell Mailing List | Subject: [Haskell] A question about fundeps <-> GADT interaction | |

RE: [Haskell] Boxing (Day) Question

2005-12-29 Thread Simon Peyton-Jones
Ashley I think Lennart answered your question rather well. As he says, the restriction is that an unboxed type must not instantiate a polymorphic type variable (and that polymorphic type variables may not have an unboxed kind). You may like to read the paper "Unboxed types as first-

[Haskell] Re: Boxing (Day) Question

2005-12-28 Thread Ashley Yakeley
Taral wrote: Just a strange thought, but what about... foo :: x# -> ... => ... foo (void *x, ...) { ... } Just because it's unboxed doesn't mean it isn't in memory... Then you have to worry about garbage collection. That's OK, but that would be a separate kind, pointers to unboxed values tha

Re: [Haskell] Re: Boxing (Day) Question

2005-12-28 Thread Taral
On 12/26/05, Ashley Yakeley <[EMAIL PROTECTED]> wrote: > I thought functions receive dictionaries, rather than dictionaries being > stored inside values? For instance: > > class C (x :: #4) where ... > > foo :: (C x) => x -> Bool > foo x = ... > > might be generate something like this: > >

Re: [Haskell] Re: Boxing (Day) Question

2005-12-28 Thread Bulat Ziganshin
Hello Ashley, Tuesday, December 27, 2005, 2:46:11 AM, you wrote: >> it's unserious :) overloading of unboxed types must be resolved at >> compile time, as in C++ templates. Why can't (->>) that's been specialised to #4 -> #4 -> * just generate a AY> function that takes an anonymous 4-byte quan

[Haskell] Re: A question about fundeps <-> GADT interaction

2005-12-27 Thread oleg
Tomasz Zielonka wrote: > I tried to implement another function: > > mapChildren :: (forall a. Term f a -> Term f a) -> Term f b -> Term f b > mapChildren fun t@(Lit x) = t > mapChildren fun (IsZero t) = IsZero (fun t) > mapChildren fun (Succ t) = Succ (fun t) > mapChildren fun (If c t e)

[Haskell] Re: A question about fundeps <-> GADT interaction

2005-12-27 Thread Tomasz Zielonka
On Fri, Dec 23, 2005 at 12:10:07PM +0100, Tomasz Zielonka wrote: > On Fri, Dec 23, 2005 at 03:34:40AM -, [EMAIL PROTECTED] wrote: > > > > [Sorry for possible duplication, our DNS server seems to be broken, > > and the sysadm is on vacation] > > > > I don't think that is the problem with GADT

[Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Ashley Yakeley
In article <[EMAIL PROTECTED]>, Lennart Augustsson <[EMAIL PROTECTED]> wrote: > Yes, I think it would work. But I'd think it would be awkward. > Now you need to know the size of each unboxed type to make polymorphic > functions (and that's not even portable). Yes, your polymorphic types and fun

Re: [Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
Ashley Yakeley wrote: In article <[EMAIL PROTECTED]>, Lennart Augustsson <[EMAIL PROTECTED]> wrote: On the whole it looks like you want type variables with kind #. There are very good implementation reasons for not allowing this. If you had type variables of kind # you could have polymorphic

[Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Ashley Yakeley
In article <[EMAIL PROTECTED]>, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > it's unserious :) overloading of unboxed types must be resolved at > compile time, as in C++ templates. Why can't (->) that's been specialised to #4 -> #4 -> * just generate a function that takes an anonymous 4-byte q

RE: [Haskell] Boxing (Day) Question

2005-12-26 Thread Nick Benton
>That reminds me of something that I have wondered about for some >time. Why is there such reluctance to instantiate polymorhic functions >with the types with which they are used? (This isn't done automatically >in complilers right?) MLj, SML.NET and MLton all compile polymorphism this way. They c

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
Niklas Sorensson wrote: That's what I thought. But I'm still curious when it is used, and why it isn't a suitable solution for unboxed polymorhic functions in most cases. But getting most cases right isn't enough, you have to get all cases right. So if you want to have unboxed polymorphic func

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Niklas Sorensson
>> I can imagine that it is akward to delay code generation until all uses >> of a function are known, and that in some cases there may be infinitely >> many instances needed. But apart from that, what are the reasons >> against this implementation technique? > > What made you think that this tech

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Tomasz Zielonka
On Mon, Dec 26, 2005 at 02:22:57PM +0100, Niklas Sorensson wrote: > That reminds me of something that I have wondered about for some > time. Why is there such reluctance to instantiate polymorhic functions > with the types with which they are used? (This isn't done automatically > in complilers rig

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Niklas Sorensson
> On the whole it looks like you want type variables with kind #. > There are very good implementation reasons for not allowing this. > If you had type variables of kind # you could have polymorphic > functions over unboxed values. But since the values are unboxed > they don't have a uniform repre

Re: [Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Bulat Ziganshin
Hello Ashley, Monday, December 26, 2005, 2:41:38 PM, you wrote: >> On the whole it looks like you want type variables with kind #. >> There are very good implementation reasons for not allowing this. >> If you had type variables of kind # you could have polymorphic >> functions over unboxed values

[Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Ashley Yakeley
In article <[EMAIL PROTECTED]>, Lennart Augustsson <[EMAIL PROTECTED]> wrote: > On the whole it looks like you want type variables with kind #. > There are very good implementation reasons for not allowing this. > If you had type variables of kind # you could have polymorphic > functions over unb

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
On the whole it looks like you want type variables with kind #. There are very good implementation reasons for not allowing this. If you had type variables of kind # you could have polymorphic functions over unboxed values. But since the values are unboxed they don't have a uniform representation

[Haskell] Boxing (Day) Question

2005-12-26 Thread Ashley Yakeley
As I understand it, with unboxing switched on (->) actually has this kind: (->) :: ? -> ? -> * Reading the Core specification, GHC has a particular kind of "polykindism" which introduces kind "?", and defines specialisation such that "?" may be replaced by "*" or "#" inside any kind. Accordi

[Haskell] Re: A question about fundeps <-> GADT interaction

2005-12-23 Thread Tomasz Zielonka
On Fri, Dec 23, 2005 at 03:34:40AM -, [EMAIL PROTECTED] wrote: > > [Sorry for possible duplication, our DNS server seems to be broken, > and the sysadm is on vacation] > > I don't think that is the problem with GADTs. The following works > > > untype :: Term f a -> Term Untyped () > > untyp

  1   2   3   4   5   6   7   >