On Fri, 2008-05-02 at 00:10 +0400, Daniil Elovkov wrote:
> Felipe Lessa wrote:
> > On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa <[EMAIL PROTECTED]> wrote:
> >> On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries <[EMAIL PROTECTED]> wrote:
> >> > So then the question becomes: what *is* the best way to
Graham Fawcett wrote:
I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
response. So, something like:
sendCmd :: (Handle, Handle) -> String -> IO
2008/5/1 Galchin, Vasili <[EMAIL PROTECTED]>:
> Here is a simpler case of what I want to do ..
>
> 1) To function1 pass in (Maybe Int).
>
> 2) If "Nothing" then pass nullPtr to C function.
>
> 3) If "Just 1", then pass a pointer to a "1" to teh same C function.
Check out Foreign.maybeWith.
___
Just a quick announcement, I've uploaded to hackage 'ghc-core' , a
wrapper over ghc for displaying the optimised core and assembly language
ghc produces from your programs.
The code is colourised by hscolour, and displayed in a pager, git-log style.
This will be useful for those who like looking
Here is a simpler case of what I want to do ..
1) To function1 pass in (Maybe Int).
2) If "Nothing" then pass nullPtr to C function.
3) If "Just 1", then pass a pointer to a "1" to teh same C function.
Thanks, Vasili
On Thu, May 1, 2008 at 8:18 PM, Galchin, Vasili <[EMAIL PROTECTED]> wrote:
Sorry .. my example was bad. I want to use "x" .. in then branch where it
occur ...
e.g.
bonzo :: Maybe Bozo -> IO ()
bonzo maybe_bozo = do
case maybe_bozo of
Just (Bozo x) -> x
_-> .
??
Thanks, V.
On Th
2008/5/2 Galchin, Vasili <[EMAIL PROTECTED]>:
>
> data Bozo =
> Bozo {
> id :: Int
> }
>
> bonzo :: Maybe Bozo -> IO ()
> bonzo maybe_bozo = do
>if maybe_bozo == (Just (Bozo x))
> then
> return ()
> else
> return ()
bonzo maybe_bozo =
case may
Galchin, Vasili wrote:
data Bozo =
Bozo {
id :: Int
}
bonzo :: Maybe Bozo -> IO ()
bonzo maybe_bozo = do
if maybe_bozo == (Just (Bozo x))
then
return ()
else
return ()
~
>
> I want "x" to be a pattern that matches "id" ??
Try:
bonzo (Ju
data Bozo =
Bozo {
id :: Int
}
bonzo :: Maybe Bozo -> IO ()
bonzo maybe_bozo = do
if maybe_bozo == (Just (Bozo x))
then
return ()
else
return ()
~
I want "x" to be a pattern that matches "id" ??
Kind regards, Vasili
_
Are you adjusting 'System.IO.hSetBuffering' to NoBuffering for those handles?
Graham Fawcett wrote:
Hi folks,
I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another com
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I am trying to understand the QuickCheck source in a bit of depth and
I have noted that a Gen x is a function Int -> StdGen -> x, however,
some of the combinators can at times, fail to ever produce a result by
throwing an error. I include an example us
No it doesn't, but it's on the TODO list. It needs a fix in GHC.
By the way, I'm going to experiment with doing the parsing of comments
on the Haddock side instead of in GHC.
If that works out, we won't have to fix these things in GHC anymore.
If anyone wants to help out with Haddock, the darcs r
Hi folks,
I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
response. So, something like:
sendCmd :: (Handle, Handle) -> String -> IO [String]
...
Felipe Lessa wrote:
On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa <[EMAIL PROTECTED]> wrote:
On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries <[EMAIL PROTECTED]> wrote:
> So then the question becomes: what *is* the best way to write this function?
I guess it would be simpler to have the counter
On 2008.05.01 15:42:19 +0200, David Waern <[EMAIL PROTECTED]> scribbled 0.5K
characters:
> Hi everyone,
>
> I'm pleased to announce Haddock 2.1.0.
>
> Hackage page:
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.1.0
>
> Changes since last version:
>
> * Fix a bug that ma
Wouter Swierstra <[EMAIL PROTECTED]> wrote:
> Hi Creighton,
> > Where could I find a proof that the initial algebras & final
> > coalgebras of CPO coincide? I saw this referenced in the
> > "Bananas.." paper as a fact, but am not sure where this comes from.
> I couldn't find the statement you
On Thu, May 1, 2008 at 9:44 AM, Felipe Lessa <[EMAIL PROTECTED]> wrote:
> On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries <[EMAIL PROTECTED]> wrote:
> > So then the question becomes: what *is* the best way to write this
> function?
>
> I guess it would be simpler to have the counter on the data
A great step by step introduction:
http://mult.ifario.us/p/wiring-haskell-into-a-fastcgi-web-server
On Apr 25, 2008, at 7:28 AM, Cetin Sert wrote:
Hi,
What is the fastest way to set up a web server that can redirect
requests to a haskell application and serve results returned by it?
I ne
On Thu, May 1, 2008 at 9:54 AM, Wouter Swierstra <[EMAIL PROTECTED]> wrote:
>
> > Where could I find a good treatment on data vs. codata & the difference
> between well-founded recursion & well-founded(?) corecursion?
> >
>
> Bart Jacobs has some good papers on the subject. I found the draft of hi
Hi Creighton,
Where could I find a good treatment on data vs. codata & the
difference between well-founded recursion & well-founded(?)
corecursion?
Bart Jacobs has some good papers on the subject. I found the draft of
his book "Introduction to Coalgebra" quite good:
http://www.cs.ru.nl/
Hi everyone,
I'm pleased to announce Haddock 2.1.0.
Hackage page:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.1.0
Changes since last version:
* Fix a bug that made links point to the defining module instead
of the "best" one (e.g Int pointing to GHC.Base instead
On Thu, May 1, 2008 at 9:32 AM, Edsko de Vries <[EMAIL PROTECTED]> wrote:
> So then the question becomes: what *is* the best way to write this function?
I guess it would be simpler to have the counter on the data type and a
smart branch constructor:
> data Tree = Leaf Integer | Branch Integer Tr
Hi,
Thanks to Miguel for pointing out my silly error. So at least my
understanding of tail recursion is correct :) So then the question
becomes: what *is* the best way to write this function? One version I
can think of is
> ecount :: [Tree] -> Integer -> Integer
> ecount [] acc =
Copy-paste approach's failed you. Hint: try removing acountL
definition and compiling everything else.
-- count with tail calls for the left subtree
acountL :: Tree -> Integer -> Integer
acountL (Leaf _) acc = acc + 1
acountL (Branch t1 t2) acc = acountL t1 $! (acountL t2 acc)
-- coun
Hi,
I am writing a simple compiler for a small DSL embedded in Haskell, and
am struggling to identify and remove the source of a stack error when
compiling larger examples. To understand the issues better, I was
playing around with tail recursion on trees when I came across the
following problem.
25 matches
Mail list logo