Leonard Siebeneicher wrote:
Dear reader,
I wonder whether there is a 'general' working solution to include files
within a parsec parser. Without the need of unsafePerformIO.
At least in parsec 2, I don't think so. Our solution was to read in the
main file, tokenise it (using Alex), preproce
.shawn wrote:
> On page 141 of "Yet another Haskell Tutorial" (9.7 Monad Transformers)
>
> mapTreeM action (Leaf a) = do
> lift (putStrLn ("Leaf" ++ show a))
> b <- action a
> return (Leaf b)
>
> mapTreeM :: (MonadTrans t, Monad (t IO), Show a) => (a -> t IO a1) ->
> Tree a -> t IO (Tree a1)
>
> Wh
Ketil Malde wrote:
So the naïve attempt at doing this would be something like:
thread = do
-- grab "lock 1"
t <- readTVar lock
when t retry
writeTVar lock True
-- grab "lock 2"
t2 <- readTVar lock2
when t2 retry writeTVar
write
Ketil Malde wrote:
Hi,
Browsing LWN, I ran across this comment:
http://lwn.net/Articles/336039/
The author makes a bunch of unsubstantiated claims about STM, namely
that all implementations use locking under the hood, and that STM can
live- and deadlock. I've seen a lot of similar sentiments
Hi,
I'm presuming the problem with your result is that the "is in the times map, and not in the store map (you weren't clear on the
exact problem).
I took a look at the code, here's my thoughts on why this occurs. If
you start by putting something in the cache with key "foo", an entry is
cr
Andy Stewart wrote:
So have a better solution to avoid write above ugly code
How about:
data Page a =
Page {pageName :: IORef String
,pageId:: Int
,pageBuffer:: a
,pageBox :: VBox
}
class PageBuffer a where
pageBufferClone :: a ->
Hi all,
I've just put the first release of the Alloy generic programming library
on Hackage [1].
Alloy (née Polyplate) is intended to be a fairly fast blend of several
other generics approaches, such as SYB (but without the dynamic typing)
and Uniplate (but allowing an arbitrary number of ta
Hans van Thiel wrote:
Hello,
I want to get the top or the bottom elements of a graph, but the
following code appears to give the wrong answer in most cases, and the
right answer in a few cases. Any ideas?
-- get the most general or the least general elements
graphMLGen :: Bool -> Gr [Rule] (
Duncan Coutts wrote:
What we're currently missing is a PVP checker: a tool to compare APIs of
package versions and check that it is following the PVP. Ideally, we
will have packages opt-in to follow the PVP for those packages that do
opt-in we have the PVP enforced on hackage using the checker to
Michael P Mossey wrote:
I've got one of those algorithms which "threatens to march off the
right edge" (in the words of Goerzen et al). I need something like a
State or Maybe monad, but this is inside the IO monad. So I presume I
need StateT or MaybeT. However, I'm still (slowly) learning about
Sittampalam, Ganesh wrote:
We've discussed replacing it with transformers+monads-fd+an mtl
compatiblity layer on librar...@. Ross and I plan to propose doing this
for the second release of the platform - it's not fair to disrupt the
first release at this stage.
transformers+monads-fd is quite a
Maurício wrote:
Hi,
When we want to list which declarations are exported by a module
we do:
module Mod ( list of exports ) where ...
Are there propositions to alternatives to that (I could not
find one)? Like, say, add a "do export" or "do not export"
tag to declarations we want to (not) expor
Sven Panne wrote:
Regarding Functor/Applicative: The obvious instances for e.g. a 2-dimensional
vertex are:
data Vertex2 a = Vertex2 a a
instance Functor Vertex2 where
fmap f (Vertex2 x y) = Vertex2 (f x) (f y)
instance Applicative Vertex2 where
pure a = Vertex2 a a
Hi,
(1+) :: Num a => a -> a
For the bind operator, you need something of type a -> Maybe b on the
RHS, not simply a -> a. You want one of these instead:
fmap (1+) (Just 3)
liftM (1+) (Just 3)
Alternatively, you may find it useful to define something like:
(>>*) = flip liftM
so that you ca
properly, the slight variation is actually a good test). What I would
like to know is are there any plans for GHC to incorporate
user-definable scheduler?
What exactly is it that you want from a user-definable scheduler? Do
you want co-operative scheduling in your program, or do you want to
Neil Mitchell wrote:
I didn't at first, then I remembered:
1 + True
=
fromInteger 1 + True
And if we have Num for Bool, it type checks.
Does that also mean that you could write:
if 3 - 4 then ... else ... (= if (fromInteger 3 :: Bool) - (fromInteger
4 :: Bool) then ... else ...)
or per
Itsme (Sophie) wrote:
I could not find any contact info for Brian O'Sullivan, Don Stewart,
or John
Goerzen on their book site. Any pointers to how I might locate any of
them
much appreciated.
Two of the three have posted to this list in the last 24 hours, so you
can take their email addresses
Hi,
When we needed to do something similar with Parsec, we chose to pack the
relevant source position into the error string (you can just use
Show/Read, plus a special sequence of characters to indicate where the
position ends and the real error starts). We then unpack it outside
runParser b
Martijn van Steenbergen wrote:
Hello,
Mr. McBride and mr. Paterson define in their Applicative paper:
data Except e a = OK a | Failed e
instance Monoid e => Applicative (Except e) where ...
Sometimes I'd still like to use >>= on Excepts but this "feels" wrong
somehow, because it doesn't use
Bas van Gijzel wrote:
Hello everyone,
I'm doing a bachelor project focused on comparing parsers. One of the
parser libraries I'm using is Parsec (2) and I'm going to implement a
very small subset of haskell with it, with as most important feature
the off-side rule (indentation based parsing)
Hi,
I have a Haskell problem that keeps cropping up and I wondered if there
was any solution/work-around/dirty-hack that could help. I keep wanting
to define class instances for things like Functor or Monad, but with
restrictions on the inner type. I'll explain with an example, because I
fi
101 - 121 of 121 matches
Mail list logo