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
|
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)
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
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
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
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
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
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
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
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
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
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
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
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,
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,
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
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)
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
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
[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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
34 matches
Mail list logo