definition of take

2005-02-16 Thread Jorge Adriano Aires
Hi, I don't know much about the internals of GHC, but I like look around once in a while to learn a few things. I was wondering about the definition of take, which is, for Ints: - takeUInt :: Int# - [b] - [b] takeUInt n xs |

Re: Implicit parameters:

2005-01-19 Thread Jorge Adriano Aires
Isn't it just the monomorphism restriction at work? This works fine: f () = do    a - get_unique    putStr (showInt a \n)    b - get_unique    putStr (showInt b \n)    c - get_unique    putStr (showInt c \n)                                                                                 

Re: Problem with Unboxed Types

2004-08-27 Thread Jorge Adriano Aires
GHC.Exts showUnboxedInt :: Int# - String showUnboxedInt n = (show $ I# n) ++ # main = print (showUnboxedInt 3#) | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow-haskell-users- | [EMAIL PROTECTED] On Behalf Of Jorge Adriano Aires | Sent: 27 August 2004 02:55

Problem with Unboxed Types

2004-08-26 Thread Jorge Adriano Aires
Hello, I'd like to try using Unboxed types, but I always get a parse error on input `#' error. To make sure I wasn't making some mistake I tried the example in the wiki: http://www.haskell.org/hawiki/UnboxedType module Main where import

Re: How do I specify the source search path?

2004-06-30 Thread Jorge Adriano Aires
On Wednesday 30 June 2004 16:15, S. Alexander Jacobson wrote: I have the working code for my Haskell App Server Framework in ~/HAppS/HAppS.hs. If I want to start working on an app that uses this framework in e.g. ~/MyApp, how do I tell GHCi to resolve import HAppS? Note: The HAppS code is

Re: Namespace trouble

2004-05-20 Thread Jorge Adriano Aires
Jorge Adriano Aires [EMAIL PROTECTED] writes: I have the following structure: MyProgram/A.hs MyProgram/Aux/B.hs MyProgram/Aux/C.hs You have already received replies to your question, so let me make a different point. If you ever intend your program to work on Windows, do not use

Namespace trouble

2004-05-19 Thread Jorge Adriano Aires
Hello, I have the following structure: MyProgram/A.hs MyProgram/Aux/B.hs MyProgram/Aux/C.hs and: A imports C B imports C Can I make this work using namespaces only (i.e. no -i flag)? I expected this to work: MyProgram/A.hsname: Aimport Aux.C

Re: Namespace trouble

2004-05-19 Thread Jorge Adriano Aires
I expected this to work: MyProgram/A.hsname: Aimport Aux.C MyProgram/Aux/B.hsname: Aux.Bimport C MyProgram/Aux/C.hsname: Aux.C But complains when importing C from B since its name is Aux.C. What is the most elegant way to deal with such cases? Answering

Ambiguous type variable

2003-01-22 Thread Jorge Adriano
Hi all, This works fine, as expected f :: (Num a, Random a) = Int - [a] f = randomRs (0,1).mkStdGen If I skip the type signature, though, I get the following error messages: Main.hs:14: Ambiguous type variable(s) `a' in the constraint `Random a' arising from use of `randomRs' at

Re: ANNOUNCE: GHC version 5.04.2 released

2002-12-17 Thread Jorge Adriano
Hi, Are there going to be SuSE rpms available anytime soon? Anyone working on them? Thanks, J.A. ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: Bug? [was: Implicit params]

2002-11-18 Thread Jorge Adriano
Now fixed in the HEAD, and will be in 5.04.2 Thanks for pointing it out. Simon Thanks :) J.A. ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Bug? [was: Implicit params]

2002-11-14 Thread Jorge Adriano
On Thursday 14 November 2002 18:47, Iavor S. Diatchki wrote: hello, Well, actually you must be right since the pure field defines a pure (projection) function... Hmmm, ok, can someone explain this to me, data E s = E{ refi :: STRef s Int, refc :: STRef s Char, m

Re: Record of STRefs better than STRef to a Record?

2002-11-13 Thread Jorge Adriano
If I use an STRef to a record, will a new record be created each time I want to update a single field? Or can I expect GHC to optimize it and have the field of the record updated in place? You'll get a new record for each update. This might not be so bad though, depending on the

Re: Record of STRefs better than STRef to a Record?

2002-11-13 Thread Jorge Adriano
I'm passing that 'record' around as an implicit value. The record as STRefs that I use to collect info, but it also has some pure fields with 'read-only' info. Something like, opss let me change 'max' to 'm' data E s = E{ refi :: STRef s Int, refc :: STRef s Char,

Record of STRefs better than STRef to a Record?

2002-11-12 Thread Jorge Adriano
Hi all, If I use an STRef to a record, will a new record be created each time I want to update a single field? Or can I expect GHC to optimize it and have the field of the record updated in place? Right now I'm using a record of STRefs, like: data E s = E{ refi :: STRef s Int,

Re: Docs missing?

2002-07-24 Thread Jorge Adriano
The doc RPM package for Red Hat 7.3 suffers the same problem as the SuSE one. Could someone please give a hand-holding guide so that we can fix it ourselves? Please? Please? It's easy ;) Go to http://haskell.cs.yale.edu/ghc/documentation.html and in the downloadable/printable

Re: DeepSeq

2002-07-19 Thread Jorge Adriano
On Friday 19 July 2002 12:10, George Russell wrote: Would it be possible to bring the DeepSeq library into the libraries distributed with GHC? (I think Dean Herington is responsible for it.) Of course it's easy enough to drop it into one's own program (I am just about to do this) but (1)

Re: order of computation in 'do' notation

2002-04-25 Thread Jorge Adriano
NOTE: Even the examples are correct in the H98 libraries documentation in the IO module section, they are incorrect in the H98 Report: http://www.haskell.org/onlinereport/io-13.html Scroll down, to 7.2. snip when I put the same code through ghc, it waits for a command first, and then when

Re: Bug?

2002-04-17 Thread Jorge Adriano
On Wednesday 17 April 2002 03:15, Jorge Adriano wrote: [1] Bug1? This declaration: A = (,) Int Int Opsss cut and paste problems :) data A = (,) Int Int is accepted by ghci. Is this behaveour correct, This is what I meant. Anyway in Bug 2 I used the 'correct' declaration [2] Bug2

Bug?

2002-04-16 Thread Jorge Adriano
[1] Bug1? This declaration: A = (,) Int Int is accepted by ghci. Is this behaveour correct, 1. It kind of shadows (,) is defined in PrelTup meaning that you can no longer use (,) prefix to refer to tuples - like (,) 1 2. 2. Seems to me like (,) is not correct syntax for a consym as defined in

Re: GHC 5.02.3, SuSE rpms

2002-04-09 Thread Jorge Adriano
On Tuesday 09 April 2002 08:38, Ralf Hinze wrote: I've uploaded SuSE 7.3 rpms for the patchlevel release of the Glasgow Haskell Compiler (GHC), version 5.02.3. http://www.informatik.uni-bonn.de/~ralf/ghc-5.02.3-1.src.rpm

Re: strange behavior with ghci version 5.02.2

2002-02-14 Thread Jorge Adriano
After loading a module with :l Module you can't use the Prelude functions unqualified, you just get things like interactive:1: Variable not in scope: `show' I am pretty sure that this worked some days ago, and I was using the same version then. I feel totally confused. Has this

Re: efficiency question

2002-02-11 Thread Jorge Adriano
On Monday 11 February 2002 02:10, Hal Daume III wrote: So instaed of storing 1 and 2 in the list, it stores pointers to them. The reason it does this is so that it makes it easy to generate code for polymorhpic functions. (,) being boxed means that instead of storing a pair of element,

Re: efficiency question

2002-02-10 Thread Jorge Adriano
On Sunday 10 February 2002 18:48, Kirsten Chevalier wrote: I'd guess that it's not just that you have to apply the (,) constructor -- it also has to do with the fact that the tuples it's constructing here are boxed. could you elaborate a little more on that (boxed / unboxed) or provide a link

Re: efficiency question

2002-02-08 Thread Jorge Adriano
On Friday 08 February 2002 22:14, Hal Daume III wrote: define test1 l = let s1 = foldr (+) 1 l s2 = foldr (-) 1 l in (s1, s2) test2 l = let s = foldr (\x (a,b) - (x+a,x-b)) (1,1) l in s why is test1 so much faster than test2 for long lists l (eg

Re: efficiency question

2002-02-08 Thread Jorge Adriano
I'd say that's because in the second case you also got to apply the (,), besides the (+)/(-) constructor during the transversing... Am I right? opss... I meant to write: the (,) constructor besides the (+)/(-)... J.A. ___ Glasgow-haskell-users

Re: Passing values taking implicit parameters

2002-01-31 Thread Jorge Adriano
I'd like write a function taking values with implicit parameters. This may not be exactly what you're after, but .. I understand the need for implicit parameters (sometimes when my functions seem to need A LOT of parameters, the code looks really messy, and adding another parameter is a

Re: Passing values taking implicit parameters

2002-01-31 Thread Jorge Adriano
BEGIN wishlist: snip My whilist for records. 'Records' provide projection functions, but IMO that is not enough, it would be really handy to have some 'update' and 'apply field' functions provided automaticly for each field. I always find myself having to write this functions by hand for

Re: Passing values taking implicit parameters

2002-01-31 Thread Jorge Adriano
Forgot to mention that a particular case in which these functions are extremely useful, is when using implicit parameters as John Huges describes in http://www.md.chalmers.se/~rjmh/Combinators/MonadTransformers.hs opsss wrong link, correct one is: http://www.md.chalmers.se/~rjmh/Globals.ps

Re: State Transformer

2002-01-28 Thread Jorge Adriano
On Saturday 12 January 2002 07:31, Ashley Yakeley wrote: At 2002-01-11 06:18, Jorge Adriano wrote: The whole problem is with passing the 'r' as a parameter, which is precisly what I'm trying to avoid. You could always pass it implicitly (using -fglasgow-exts): Thanks, at first it seemed

Bug? Re: GHC version 5.02.2 is available - SuSE RPMs

2002-01-12 Thread Jorge Adriano
Here are SuSE RPMs (built with SuSE 7.3 but I guess they also work with earlier versions): http://www.informatik.uni-bonn.de/~ralf/ghc-5.02.2-1.i386.rpm http://www.informatik.uni-bonn.de/~ralf/ghc-prof-5.02.2-1.i386.rpm Just tried them out and something seems to be wrong... I'm running

Re: Bug? Re: GHC version 5.02.2 is available - SuSE RPMs

2002-01-12 Thread Jorge Adriano
module Main where main :: IO() main = do putStr n: n - readLn :: IO(Int) print n Used to work fine with ghc 5.00.2, that is, it would print n:, then wait for the input, and finaly print n. With Ghc 5.02.2 it only prints n: after reading the n. snip

Re: State Transformer

2002-01-11 Thread Jorge Adriano
If I understand you correctly, you want global mutable variables, right? This is, I believe, only possible using IORef's and unsafePerformIO. Kind of, I'm searching for the best approach to keep track of data in my algorithms without constantly changing signatures. State monad as defined in

Re: State Transformer

2002-01-11 Thread Jorge Adriano
I agree with you. My work-around is then to define foo and bar locally to testfunc, in the scope of r: testfunc = do r - newSTRef ('x',0) let foo = do (c,n) - readSTRef r writeSTRef r ('a', n+1) bar = do