On Wednesday 06 December 2006 07:40, Bernie Pope wrote:
On 05/12/2006, at 1:00 PM, Benjamin Franksen wrote:
Bernie Pope wrote:
If you want a global variable then you can use something like:
import System.IO.Unsafe (unsafePerformIO)
global = unsafePerformIO (newIORef [])
while pondering over the four fours problem, I wondered: Is there a
function of type
(a - [b]) - [a - b]
It looks a bit like sequence when applied in the ((-) a) Monad:
sequence :: [a - b] - a - [b]
but I was looking for the other direction.
I came up with:
\g - map
I'll make a random comment...
Tim Newsham wrote:
I am writing some code with complex nested state. I have a question
about performance with respect to the State monad and the Reader monad.
A side comment is this code:
instance MonadReader s (State s) where
ask = get
local f m = fmap
On Mon, Nov 13, 2006 at 12:44:05PM -0800, Donn Cave wrote:
Threads, maybe? Is blocking I/O seriously incompatible with the GHC
threading model (or one of the models)?
The problem is that a blocking IO call would block all threads. We could
execute all such calls in their own OS thread, but
Ian Lynagh wrote:
Does anyone know what could cause this locking and/or how to prevent it?
Nothing else springs to mind. Are you able to send an example that shows
the problem? (obviously the smaller the example, the better).
I'll try to cut down the offending program to a workable size.
I'll make a random comment...
Thanks for the comments!
instance MonadReader s (State s) where
ask = get
local f m = fmap (fst . runState m . f) get
ahh, hadn't thought of doing that.
You want performance but this pushes more work to the compiler. If this were
all functional instead
I'm reading Chris Okasaki's Purely Functional Data Structures, and some
of his Haskell is confusing me. He defines the type Color and RedBlackSet
as:
data Color = R | B
data RedBlackSet a = E | T Color (RedBlackSet a) a (RedBlackSet a)
and then later he defines a function insertSet:
Justin Bailey [EMAIL PROTECTED] writes:
I'm reading Chris Okasaki's Purely Functional Data Structures, and some
of his Haskell is confusing me. He defines the type Color and RedBlackSet
as:
data Color = R | B
data RedBlackSet a = E | T Color (RedBlackSet a) a (RedBlackSet a)
and
On 06 Dec 2006 19:33:51 +, Jón Fairbairn [EMAIL PROTECTED]
wrote:
and in the where statement:
T _ a y b = ins s
Here it's a pattern match. So if ins s returns (T x a' y'
b'), then a = a'; y = y'; b = b' are used in the expresion
covered by the where clause.
Great, thanks
What I don't understand is his use of the T constructor, both at
insertSet x s = T B a y b
Here it creates a new RedBlackSet
and in the where statement:
T _ a y b = ins s
Here it's a pattern match. So if ins s returns (T x a' y'
b'), then a = a'; y = y'; b =
I don't think I'm the only one confused here. Henrik Nilson in his
paper on adding GADTs to Yampa comments that:
However, the recent addition of Generalized Algebraic Data
Types (GADTs) [26] to the list of Haskell extensions supported
by the Glasgow Haskell Compiler (GHC) gives
Yes. I've run into similar issues with hs-plugins (albeit not the
same). What platform are you running on? How are you compiling your
code? Try compiling it with the -threaded flag and see if it fixes
your problem.
On 12/6/06, Arie Peterson [EMAIL PROTECTED] wrote:
Ian Lynagh wrote:
Does
Justin Bailey wrote:
I'm reading Chris Okasaki's Purely Functional Data Structures, and
some of his Haskell is confusing me. He defines the type Color and
RedBlackSet as:
data Color = R | B
data RedBlackSet a = E | T Color (RedBlackSet a) a (RedBlackSet a)
and then later he defines a
On Thursday 07 December 2006 09:44, S. Alexander Jacobson wrote:
I guess I'm also not sure what belongs in a GADT and what belongs in a
typeclass e.g. here is an Arrow GADT
data Arrow b c where
Arr::(b-c) - Arrow b c
Compose::Arrow b c - Arrow c d - Arrow b d
First::Arrow
Stefan O'Rear wrote:
[...]
Unfortunately, it turns out that
allowing foralls inside function arguments makes typechecking much
harder, in general impossible.
Just a tiny correction: AFAIK, it is type /inference/ which becomes
undecidable in the presence of higher rank types -- checking works
Hi Alex,
S. Alexander Jacobson wrote:
I guess I'm also not sure what belongs in a GADT and what belongs in a
typeclass e.g. here is an Arrow GADT
data Arrow b c where
Arr::(b-c) - Arrow b c
Compose::Arrow b c - Arrow c d - Arrow b d
First::Arrow a b - Arrow (a,c) (b,c)
Vyacheslav Akhmechet wrote:
Yes. I've run into similar issues with hs-plugins (albeit not the
same). What platform are you running on? How are you compiling your
code? Try compiling it with the -threaded flag and see if it fixes
your problem.
My platform is amd64 (x86_64). I usually compile
Dear all,
S. Alexander Jacobson wrote:
I don't think I'm the only one confused here. Henrik Nilson in his
paper on adding GADTs to Yampa comments that:
...
In particular, GADTs are just what is needed to address the problem
discussed above since the key idea is to allow constructors
I'd like some more help from the editors in getting 2d layout right
without trying. Here's a mockup of vim with vertical grey bars
delimiting layout:
http://www.cse.unsw.edu.au/~dons/tmp/haskell+boxes.png
Does anyone know how to get this effect in vim (or emacs)?
Bonus points if the grey
dons:
I'd like some more help from the editors in getting 2d layout right
without trying. Here's a mockup of vim with vertical grey bars
delimiting layout:
http://www.cse.unsw.edu.au/~dons/tmp/haskell+boxes.png
Does anyone know how to get this effect in vim (or emacs)?
Bonus points
On Thu, Dec 07, 2006 at 11:34:42AM +1100, Donald Bruce Stewart wrote:
I'd like some more help from the editors in getting 2d layout right
without trying. Here's a mockup of vim with vertical grey bars
delimiting layout:
http://www.cse.unsw.edu.au/~dons/tmp/haskell+boxes.png
Does
On Wed, 2006-12-06 at 16:56 -0800, John Meacham wrote:
Having played with haskell parsers for various reasons, the layout rule
is quite tricky due to the rules involving 'parse-error'. if we could
come up with a formulation that didn't have those. it would make things
a whole lot nicer.
On Wed, Dec 06, 2006 at 05:37:01PM -0800, Carl Witty wrote:
On Wed, 2006-12-06 at 16:56 -0800, John Meacham wrote:
Having played with haskell parsers for various reasons, the layout rule
is quite tricky due to the rules involving 'parse-error'. if we could
come up with a formulation that
Slavomir Kaslev slavomir.kaslev at gmail.com writes:
On 11/29/06, Krasimir Angelov kr.angelov at gmail.com wrote:
It is possible of course but your definition doesn't correspond to any
operation in the usual vector algebra. By the way how do you define
(*)? Isn't it 3D vector
24 matches
Mail list logo