[Haskell-cafe] nhc vs ghc

2007-11-23 Thread brad clawsie
can anyone provide a concise list of the major differences between
nhc98 and ghc? for example, can i build a cabal package with nhc98? i
get that ghc and nhc98 are not interchangeable, otherwise i am not
sure

thanks


pgpIGhA0uHtR7.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: An interesting monad: "Prompt"

2007-11-23 Thread Derek Elkins
On Fri, 2007-11-23 at 21:11 -0800, Ryan Ingram wrote:
> On 11/22/07, apfelmus <[EMAIL PROTECTED]> wrote: 
> A context passing implementation (yielding the ContT monad
> transformer)
> will remedy this.
>  
> Wait, are you saying that if you apply ContT to any monad that has the
> "left recursion on >>= takes quadratic time" problem, and represent
> all primitive operations via lift (never using >>= within "lift"),
> that you will get a new monad that doesn't have that problem?
>  
> If so, that's pretty cool.
>  
> To be clear, by ContT I mean this monad:
> newtype ContT m a = ContT { runContT :: forall b. (a -> m b) -> m b }
>  
> instance Monad m => Monad (ContT m) where
> return x = ContT $ \c -> c x
> m >>= f  = ContT $ \c -> runContT m $ \a -> runContT (f a) c
> fail = lift . fail
>  
> instance MonadTrans ContT where
> lift m   = ContT $ \c -> m >>= c
>  
> evalContT :: Monad m => ContT m a -> m a
> evalContT m = runContT m return
>  


Indeed this was discussed on #haskell a few weeks ago.  That information
has been put on the wiki at
http://www.haskell.org/haskellwiki/Performance/Monads
and refers to a blog post http://r6.ca/blog/20071028T162529Z.html that
describes it in action.

I'm fairly confident, though I'd have to actually work through it, that
the Unimo work, http://web.cecs.pdx.edu/~cklin/  could benefit from
this.  In fact, I think this does much of what Unimo does and could
capture many of the same things.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: An interesting monad: "Prompt"

2007-11-23 Thread Ryan Ingram
On 11/22/07, apfelmus <[EMAIL PROTECTED]> wrote:
>
> A context passing implementation (yielding the ContT monad transformer)
> will remedy this.


Wait, are you saying that if you apply ContT to any monad that has the "left
recursion on >>= takes quadratic time" problem, and represent all primitive
operations via lift (never using >>= within "lift"), that you will get a new
monad that doesn't have that problem?

If so, that's pretty cool.

To be clear, by ContT I mean this monad:
 newtype ContT m a = ContT { runContT :: forall b. (a -> m b) -> m b }

instance Monad m => Monad (ContT m) where
return x = ContT $ \c -> c x
m >>= f  = ContT $ \c -> runContT m $ \a -> runContT (f a) c
fail = lift . fail

instance MonadTrans ContT where
lift m   = ContT $ \c -> m >>= c

evalContT :: Monad m => ContT m a -> m a
evalContT m = runContT m return

  -- ryan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unix (Posix) low-level device driver functionality?

2007-11-23 Thread Bryan O'Sullivan

Galchin Vasili wrote:

In any case, it seems like the GHC 
documentation allows "raw driver I/O"but when I look at the actual GHC 
6.8.1 libraries I don't see low level driver functionailty.


On Unix, at least, you don't need anything special to write userspace 
device drivers.  You normally open a special file in /dev, maybe memory 
map some of it into your address space, then use read, write, select, 
ioctl, and memory-mapped I/O.


There isn't a direct Haskell interface to ioctl, but you can write an 
FFI wrapper for it and use hsc2hs to marshal Storable instances as 
necessary, based on their C definitions.


Using the normal Unix read, write, and select functions is a bit tricky 
due to GHC's default of non-blocking I/O.  Device drivers are often very 
tetchy about the exact mode in which they're accessed, and a driver 
written for blocking I/O can simply fall over if you try non-blocking 
access.  The easiest thing to do is to rewrap them (and open, of course) 
using the FFI so that you can control the blocking behaviour.


As for memory-mapped I/O for doing the likes of PIO or DMA, 
Data.ByteString has an mmap wrapper, but it's not currently built, and 
wouldn't be especially useful for the kind of super-low-level control 
you need if you're bit-banging a device directly.  For that, you would 
do best to work in C, where it's more predictable what the compiler will 
and won't do with code around memory barriers and the like, and expose 
the code to Haskell in a controlled manner via the FFI.


http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unix (Posix) low-level device driver functionality?

2007-11-23 Thread Don Stewart
vigalchin:
>Hello,
> 
>   I am seriously trying to push the mainstream computer industry. I am a
>kernel developer for POSIX OS's (e.g. Linux) and Windows. I would at the
>very least be able to write "test"/correctness software in Haskell where I
>am able to open Unix/Windows drivers and test storage firmware. The
>possibility exists in Houston to do this .. I want FPLs (in particular
>Haskell) to strut their "stuff" even on humble stubble stuff like firmware
>verification. In any case, it seems like the GHC documentation allows "raw
>driver I/O"but when I look at the actual GHC 6.8.1 libraries I don't see
>low level driver functionailty.
> 
>Kind regards, Vasya

Most OS kernel work is done in FFI code over some small amount of C, and
then upwards.


http://haskell.org/haskellwiki/Applications_and_libraries/Operating_system#Standalone_operating_systems

If a binding to a particular C function you need is
missing, use the FFI to create a Haskell binding to it.

http://www.cse.unsw.edu.au/~chak/haskell/ffi/

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Unix (Posix) low-level device driver functionality?

2007-11-23 Thread Galchin Vasili
Hello,

   I am seriously trying to push the mainstream computer industry. I am a
kernel developer for POSIX OS's (e.g. Linux) and Windows. I would at the
very least be able to write "test"/correctness software in Haskell where I
am able to open Unix/Windows drivers and test storage firmware. The
possibility exists in Houston to do this .. I want FPLs (in particular
Haskell) to strut their "stuff" even on humble stubble stuff like firmware
verification. In any case, it seems like the GHC documentation allows "raw
driver I/O"but when I look at the actual GHC 6.8.1 libraries I don't see low
level driver functionailty.

Kind regards, Vasya
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Composing monads

2007-11-23 Thread Luke Palmer
On Nov 23, 2007 6:24 PM, Jules Bean <[EMAIL PROTECTED]> wrote:
> ...i.e. I wouldn't be afraid of a lambda in a case like that. IME it's
> moderately common to have to do:
>
> mapM_ (\a -> some stuff >> something_with a >> some stuff) ll

This has terrible endweight.  In this imperativesque case, I'd write:

forM_ li $ \a -> do
  some stuff
  something with a
  some stuff

Where forM_ is from Data.Foldable  (but is easily written as flip mapM_).

Luke
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Polymorphic dynamic typing

2007-11-23 Thread Roberto Zunino
Paulo Silva wrote:
> Type representations using GADTs are being used to achieve dynamic
> typing in Haskell. However, representing polymorphic types is
> problematic. Does anyone know any work about including polymorphism in
> dynamic typing?

First, a warning: fragile code follows, possibly leveraging on GHC bugs
related to mixing GADTs and type families. Comments welcome.

Here's how to make current GHC HEAD (and maybe 6.8 ?) understand some
selected polytype representations.

We introduce a type family:

   type family Apply name a :: *

Then, we select a particular polytype, say

   forall a . a -> [a]

we introduce a phantom name for it,

   data Poly1

and define Apply accordingly:

   type instance Apply Poly1 a = a -> [a]

Finally, we build type representations in the usual way:

   data Rep t where
  TPoly1 :: Rep Poly1
  TAll   :: Rep name -> Rep (forall a . Apply name a)

Note the use of impredicativity in the TAll type.

This indeed runs:

*TypeRep> poly (TAll TPoly1) (\a -> [a,a,a])
6

Regards,
Zun.


\begin{code}
{-# OPTIONS_GHC -Wall -fglasgow-exts #-}
module TypeRep where

data Rep t where
  TPoly1 :: Rep Poly1
  TPoly2 :: Rep Poly2
  TAll   :: Rep name -> Rep (forall a . Apply name a)

type family Apply name a :: *
data Poly1
type instance Apply Poly1 a = (a -> [a])

data Poly2
type instance Apply Poly2 a = ([a] -> [[a]])

poly :: forall a . (Rep a) -> a -> Int
poly (TAll TPoly1) x = length (x 'a') + length (x "wow")
poly (TAll TPoly2) x = length (x (x ['a']))
poly _ _ = 0
\end{code}
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] very elementary "import" problem .. help

2007-11-23 Thread Adam Langley
On Nov 23, 2007 1:43 PM, Galchin Vasili <[EMAIL PROTECTED]> wrote:
> I am loading the above script in ghci. However, System.Posix, System.Process
> and STM cannot be found. Network and Directory are found. I assume when ghc
> is installed on Windows that the Windows registry get populated with paths
> to GHC 'library" directory paths. Please someone tell me why I am having
> trouble importing these modules/libraries.

Well, NT used to pretend to have a POSIX layer because of some DOD
regulations I believe. I'm not sure if that still stands and wouldn't
be surprised if System.Posix just doesn't exist for Windows.
System.Process is marked as portable, so I'm not sure why that one
wouldn't be found. Finally, I believe that you want
Control.Concurrent.STM.


AGL

-- 
Adam Langley  [EMAIL PROTECTED]
http://www.imperialviolet.org   650-283-9641
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Duncan Coutts
On Fri, 2007-11-23 at 20:22 +, Paulo J. Matos wrote:
> Hi all,
> 
> I'm curious about the best way to typeset haskell code in a wordpress
> blog. Using blockquote removes all indentation. :-(

For the Gtk2Hs website I used a program (partly derived from hscolour)
to highlight and adds links to documentation. It generates xhtml which
one can just paste in.

See the hello world example on this page:

http://haskell.org/gtk2hs/documentation/

The program is here:

http://darcs.haskell.org/gtk2hs/docs/tools/AddLinks.hs


Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Composing monads

2007-11-23 Thread Thomas Schilling
On Fri, 2007-11-23 at 23:01 +0100, Roberto Zunino wrote:
> Maurí­cio wrote:
> > main = mapM_ ((putStrLn "") >*> putStrLn) $
> >   map show [1,2,3]
> 
> Using only standard combinators:
> 
> main = mapM_ ((putStrLn "" >>) . putStrLn) $ map show [1,2,3]

  == mapM_ ((putStrLn "" >>) . putStrLn . show) [1,2,3]

  == mapM_ ((putStrLn "" >>) . print) [1,2,3]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Composing monads

2007-11-23 Thread Roberto Zunino
Maurí­cio wrote:
> main = mapM_ ((putStrLn "") >*> putStrLn) $
>   map show [1,2,3]

Using only standard combinators:

main = mapM_ ((putStrLn "" >>) . putStrLn) $
  map show [1,2,3]

Zun.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] very elementary "import" problem .. help

2007-11-23 Thread Galchin Vasili
Hello,


import System.Posix
--import Network
import System.Process
--import Directory
import STM


I am loading the above script in ghci. However, System.Posix,
System.Processand STM cannot be found. Network and Directory are
found. I assume when ghc
is installed on Windows that the Windows registry get populated with paths
to GHC 'library" directory paths. Please someone tell me why I am having
trouble importing these modules/libraries.

Kind regards, vasya
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call external program and get stdout

2007-11-23 Thread Roberto Zunino
Allan Clark wrote:
> -- Create the process
>  do (_pIn, pOut, pErr, handle) <- runInteractiveCommand command
> -- Wait for the process to finish and store its exit code
> exitCode <- waitForProcess handle

Warning: this will get stuck if the command output is so big that it
fills the SO buffers. This limit is 64K here.

Regards,
Zun.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Composing monads

2007-11-23 Thread Hitesh

> main :: IO ()
> main = mapM_ ((putStrLn "") >*> putStrLn) $
>map show [1,2,3]
> 

A couple other ways to do this code.

Without monad combinators

main = mapM_ putStrLn . ("":) . intersperse "" . map show $ [1..3]


With your combinator, but collapsing it so we don't map over the
collection twice.

main = mapM_ ((putStrLn "") >*> print) $ [1..3]

- Hitesh


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Interrupting threads and ualarm

2007-11-23 Thread ROBERT DOUGLAS HOELZ
Hello Haskellers,

I have two questions for you:

* Is there a Haskell binding to the ualarm() function in unistd.h?  I looked in 
System.Posix.Signals, but there's just a binding for alarm().

* Is there a way to interrupt a blocking operation on another thread?  I 
thought about throwTo, but that seems like overkill.  Here's some example code:

import Control.Concurrent

main :: IO ()
main = do
tid <- myThreadId
forkIO $ interruptMain tid
getChar

interruptMain :: ThreadId -> IO ()
interruptMain mainThreadId = do
threadDelay 500
interrupt mainThreadId -- This is probably going to end up being throwTo, 
isn't it?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Dougal Stanton
On 23/11/2007, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm curious about the best way to typeset haskell code in a wordpress
> blog. Using blockquote removes all indentation. :-(
>

There is a code highlighter for wordpress that works for Haskell code,
but it's a bit of a pain to use, especially with the visual editor.
It'll do a one-way conversion of ">" into > whenever you do a
preview. :-(

It's easy to use though.


main = putStrLn "yo lambda"


Unfortunately WP isn't really great at handling text-preprocessors
like this or Markdown. To work properly they have to subvert the
system a bit.

D.

-- 
Dougal Stanton
[EMAIL PROTECTED] // http://www.dougalstanton.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Radosław Grzanka
2007/11/23, Paulo J. Matos <[EMAIL PROTECTED]>:
> Hi all,
>
> I'm curious about the best way to typeset haskell code in a wordpress
> blog. Using blockquote removes all indentation. :-(

I'm using geshi with wordpress on my blog (codeside.org) and drupal
(upcoming haskell.pl page). But you have to change how strings are
colored because out of the box coloring is so ugly. (It should be very
easy but I didn't bother to do it yet)

Some links:

Geshi plugin for wordpress: http://wordpress.org/extend/plugins/wp-syntax/
Geshi itself: http://qbnz.com/highlighter/

Cheers,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Claude Heiland-Allen

Paulo J. Matos wrote:

Hi all,

I'm curious about the best way to typeset haskell code in a wordpress
blog. Using blockquote removes all indentation. :-(

Cheers,



Probably HsColour:

http://www.cs.york.ac.uk/fp/darcs/hscolour/
--8<--
hscolour is a small Haskell script to colourise Haskell code. It 
currently has five output formats: ANSI terminal codes, HTML 3.2 with 
 tags, HTML 4.01 with CSS, LaTeX, and mIRC chat client codes.

--8<--

Would be nice to have a server-side thing too, though.


Thanks,

Claude
--
http://claudiusmaximus.goto10.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Neil Mitchell
Hi

> I'm curious about the best way to typeset haskell code in a wordpress
> blog. Using blockquote removes all indentation. :-(

 should work

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell code in Wordpress

2007-11-23 Thread Paulo J. Matos
Hi all,

I'm curious about the best way to typeset haskell code in a wordpress
blog. Using blockquote removes all indentation. :-(

Cheers,

-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Polymorphic dynamic typing

2007-11-23 Thread Don Stewart
derek.a.elkins:
> On Fri, 2007-11-23 at 18:45 +, Paulo Silva wrote:
> > Hello,
> > 
> > Type representations using GADTs are being used to achieve dynamic  
> > typing in Haskell. However, representing polymorphic types is  
> > problematic. Does anyone know any work about including polymorphism  
> > in dynamic typing?
> 
> Look at Clean's Dynamics.
> 
> That said, the ultimate end of this direction is to include the type
> checker in the run-time.

That is the end point. Clean's dynamics only include a stripped down
type checker -- the step beyond that is something like hs-plugins, which
reuses the compiler's type checker at runtime splice points.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Polymorphic dynamic typing

2007-11-23 Thread Derek Elkins
On Fri, 2007-11-23 at 18:45 +, Paulo Silva wrote:
> Hello,
> 
> Type representations using GADTs are being used to achieve dynamic  
> typing in Haskell. However, representing polymorphic types is  
> problematic. Does anyone know any work about including polymorphism  
> in dynamic typing?

Look at Clean's Dynamics.

That said, the ultimate end of this direction is to include the type
checker in the run-time.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Polymorphic dynamic typing

2007-11-23 Thread Paulo Silva

Hello,

Type representations using GADTs are being used to achieve dynamic  
typing in Haskell. However, representing polymorphic types is  
problematic. Does anyone know any work about including polymorphism  
in dynamic typing?


Best regards,
Paulo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Composing monads

2007-11-23 Thread Jules Bean

module Main (Main.main) where
import Control.Monad
import System.IO

(>*>) :: Monad m => m () -> (a -> m ()) -> (a -> m ())
(>*>) f f' = \a -> do{
  f;
  f' a;
}

main :: IO ()
main = mapM_ ((putStrLn "") >*> putStrLn) $
  map show [1,2,3]


There is nothing wrong with that, but I would normally write:

mapM_ (\a -> putStrLn "" >> putStrLn a) $ map show [1,2,3]

...i.e. I wouldn't be afraid of a lambda in a case like that. IME it's 
moderately common to have to do:


mapM_ (\a -> some stuff >> something_with a >> some stuff) ll

Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] c2hs on Windows?

2007-11-23 Thread Duncan Coutts
On Sun, 2007-11-11 at 21:36 +, Alex Young wrote:
> Hi all,
> 
> Does anyone know if c2hs should be working on Windows?  I'm trying to 
> build it under ghc 6.8.0, but this happens:

I just uploaded c2hs-0.15.1 which builds with all recent versions of ghc
6.4-6.8. I also tested that it builds on Windows.

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/c2hs-0.15.1

Sorry about the wait.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Composing monads

2007-11-23 Thread Maurí­cio

>> Hi,
>>
>> If I have two computations a->IO b and
>> b->IO c, can I join them to get an a->IO
>> c computation? I imagine something like a
>> liftM dot operator.

> This is called Kleisli composition, by the way; it's
> defined as (>=>) in Control.Monad.
> jcc

> Even if you didn't know about (>=>)(...):>
>
> (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
> (>=>) f g a = f a >>= g
> (...)

I always learn a lot in this list. Here is my >*>
operator, that helps the code I was actually
trying to write. Feel free to send it to
obfuscated monad composition context.

Thanks for the tips,
Maurício

---
module Main (Main.main) where
import Control.Monad
import System.IO

(>*>) :: Monad m => m () -> (a -> m ()) -> (a -> m ())
(>*>) f f' = \a -> do{
  f;
  f' a;
}

main :: IO ()
main = mapM_ ((putStrLn "") >*> putStrLn) $
  map show [1,2,3]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: {SPAM 04.4} Re[2]: [Haskell-cafe] http/ftp library

2007-11-23 Thread brad clawsie
On Fri, Nov 23, 2007 at 10:59:55AM +0300, Bulat Ziganshin wrote:
> Hello brad,
> 
> Friday, November 23, 2007, 10:10:41 AM, you wrote:
> 
> > if you need comprehensive support of http and ftp in one api/library, as
> > far as i know, the curl bindings are your only choice
> 
> 1. Haskell binding is not mentioned at http://curl.haxx.se/libcurl/
> can we do something to fix it?

we should not advertize it yet as it has not been properly packaged
and documented (once again, i am hoping to get to this soon!)

current source:
http://code.haskell.org/curl/  

some examples:
http://hpaste.org/3529 



pgps7zbKRw4AP.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Call external program and get stdout

2007-11-23 Thread Maurí­cio

>>> Hi,
>>>
>>> How can I call a program (like, for instance,
>>> 'grep text *') and get the standard output?
>>> (...)

>>http://haskell.org/ghc/docs/latest/html/libraries/process-1.0.0.0/System-Process.html

> I was using the following:
> (...)
>  do (_pIn, pOut, pErr, handle) <- runInteractiveCommand command
> -- Wait for the process to finish and store its exit code
> exitCode <- waitForProcess handle
> (...)

I also used runInteractiveCommand, which I found
in the page quoted above. I read the output handle
without waiting for the process to finish, and I
thought runInteractiveCommand would actually not
return before the external process finishes, which
your code showed me to be a wrong prejudice.

That's nice. In my situation, the output of the
program can be really big, so I prefer not to wait
for it to finish before I do stuff with the
output, but I'll probably use your code in most
situations, since I can check the exit code before
doing anything.

Best,
Maurício

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Dimensional 0.7.1 (GHC 6.8.1 compatibility)

2007-11-23 Thread Bjorn Buckwalter
Dear all,

The Dimensional library has been ported to GHC 6.8.1 (it remains
backwards-compatible with GHC 6.6.1, and also with Cabal 1.1.6 I
believe). The new version number is 0.7.1.

Due to a GHC 6.8.1 bug (#1919) the CGS module will not compile and has
been disabled.

Thanks,
Bjorn Buckwalter

http://dimensional.googlecode.com
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional
http://hackage.haskell.org/trac/ghc/ticket/1919
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Source code for Visual Haskell

2007-11-23 Thread Benedikt Schmidt
"Felix Martini" <[EMAIL PROTECTED]> writes:

> The documentation of Visual Haskell mentions that the source code is
> available under a BSD license. The code is not available from the
> download page (http://www.haskell.org/visualhaskell/downloads.html).
> Does anone know where to get it?

There is a darcs repo at http://darcs.haskell.org/vshaskell. The
last commit is from December 2006. So i do not know how up to date
it is.

  Benedikt

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Digest size

2007-11-23 Thread Simon Marlow

[ with mailing list maintainer's hat on ]

Someone asked me if they could get fewer digests per day from haskell-cafe. 
 The threshold for sending out a digest is currently 30k, which is 
probably the default, but seems a bit small to me.  Any objections to 
bumping it, to say 100k?


Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] http/ftp library

2007-11-23 Thread Yitzchak Gale
Hi Bulat,

Bulat Ziganshin wrote:
> i write a file-processing utility and want to allow users open URLs
> like the usual files.

Another option is MissingPy.
You can use the urlopen function from
Python.

Regards,
Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-23 Thread Laurent Deniau

Peter Verswyvelen wrote:

Laurent Deniau wrote:

Peter Verswyvelen wrote:
And you still need to think about where you have to introduce delays 
to avoid infinite loops?
I don't see why, unless you want to have a memory or explicitly stop 
the time which means it's a parameter of the transition as mention 
above (but instantaneous transitions seems strange). So, the causality 
of the transitions with a discrete time should not lead to infinite 
loops. The time delay exists de facto.
I'm currently reading "FRP, Continued". Maybe I got confused by the text 
on page 56, which introduces a delay (noEvent --> addOrDelCTs) to avoid 
an infinite loop.


I haven't read (yet) the paper (so take my remark with care), but 
looking roughly at this function, it seems that it tries to avoid 
infinite loop by introducing a delay (noEvent). This is like tail in a 
stream-based Fibonacci. You need to delay (or shift for a stream) input1 
vs input2 because input2 is the output of the the current 
step/transition, otherwise you get an infinite loop. This is because of 
the recursive nature of what the transition needs to do (the generator), 
not with the time.


An analogy of FRP in the OO world is the Event-based loop. If an event 
queues another event which itself (re)queue the current event, you'll 
get an infinite loop (or more probable a deadlock ;-) as well (in 
CPS-based FRP, the chain of continuations becomes infinite).


I would say that conceptually (may be wrong in this particular case), 
this happens because you do not respect the principle of causality, that 
is you're looking at the future. This is a common pattern in adaptive 
theory where memory is delays. In that case you never look at the 
future, you can only estimate it (in the case of predictive model).


Nevertheless, I think that AFRP and Signal match very well adaptive 
theory (signal processing or control theory). If I were good enough in 
Haskell (and had the time to do it, sic!), I would give a try to build 
adaptive systems on top of Yampa. The problem is that for efficiency 
reason one needs to mix Signals with things like Fast Arrays where 
arrays on the lhs are mutables but becomes immutable once on the rhs. I 
dream of a lib doing efficient signal processing on top of these two ideas.


Since nobody replied yet on my question about the future of (A)FRP, 
maybe I can ask it again here? What is the future for FRP? Are other 
approaches better suitable for reactive applications?


I missed your question, but it's an interesting question. I found very 
interesting and instructive the paper of Hai Liu and Paul Hudak on the 
problem of space leaks in FRP.


Yes that is a very interesting paper, but since I'm still trying to 
understand and use Yampa, I will have to re-read the paper.  It would be 
nice if Paul Hudak wrote a "Haskell HIGH School of Expression" book, 
explaining Yampa, because I really enjoyed the SOE book.


I agree!

a+, ld.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-23 Thread Jules Bean

Magnus Therning wrote:

Many other programming languages have packaging strategies that sound
very similar.  Several of them have managed to have a negative impact on
platforms that already have good packaging technologies (i.e. almost
every platform apart from Windows ;-).  I'd hate to see Haskell go in a
direction where packaging for e.g. Debian is made more difficult than it
is at the moment.


I think that's a reasonable fear. In black moments, I share this fear 
with the Cabal Cabal. Fortunately, they assure me that they're well 
aware of this issue and don't intend it to become a problem. As someone 
in another reply points out, it's a considerable comfort that many of 
the CC are also package maintainers for other distributions. They know 
about this stuff :)


Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Composing monads

2007-11-23 Thread Jules Bean

Maurí­cio wrote:

Hi,

If I have two computations a->IO b
and b->IO c, can I join them to
get an a->IO c computation? I imagine
something like a liftM dot operator.


You've already been shown the >=> operator and how to define it from >>= 
by other answers.


Just for variety, here is how you would define it using do notation:

compose :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
compose act act' a = do
  b <- act a
  act' b

Jules


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-23 Thread Laurent Deniau

Conal Elliott wrote:
On Nov 21, 2007 3:49 AM, Laurent Deniau <[EMAIL PROTECTED] 
> wrote:


 > Peter Verswyvelen wrote:
 > > Conal Elliott wrote:
 > >> Moreover, functional programming makes it easy to have much more 
state

 > >> than imperative programming, namely state over *continuous* time.  The
 > >> temporally discrete time imposed by the imperative model is pretty
 > >> puny in comparison.  Continuous (or "resolution-independent") time 
has

 > >> the same advantages as continuous space: resource-adaptive, scalable,
 > >> transformable.
 > > Yes, that's true, but isn't that also the problem with FRP? I mean, 
most
 > > of the papers I'm reading about (A)FRP indicate that no matter how 
nice

 > > it is to have the continuous time model

 > I agree with Conal, it's not a continuous time model but a
 > resolution-independent time model.

What do mean by resolution-independent vs continuous? 


I mean time may or may not be part or the model in FRP.

I meant them more-or-less synonymously.  Semantically, there's no notion 
of resolution.  When it's time to introduce a resolution for discrete 
rendering, there's no resolution imposed by the model.


Right. This is why I do not see the relation with the number of bits in 
a float. Time could be represented by states, in the sens of a state 
machine with asynchronous events.



 > The reason it that Arrows (like
 > Monads) encapsulate the sequence of transitions.  Unless the time is a
 > parameter of the transition, it is independent of the time (resolution),
 > but still captures its ordered nature.

I'm confused again. I don't think of Arrow as implying transitions at all.


I call a transition the operator >>= for Monad, and arr for Arrow. I was 
maybe not clear in this point. The correct wording might be a computation.



 > > to get fine grained control
 > > over execution times and resources, one needs to fall back to the
 > > discrete delta-time approach?

 > If you need synchronization, yes.

Why?  What about synchronization implies discretness in the model?


Because it requires either specific states which are aware of each other 
(asynchronous events), or a known delta-time. How do you synchronize 
continuous events (I would says more continuous processes) ?


Regards,

ld.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] http/ftp library

2007-11-23 Thread Bulat Ziganshin
Hello brad,

Friday, November 23, 2007, 10:10:41 AM, you wrote:

> if you need comprehensive support of http and ftp in one api/library, as
> far as i know, the curl bindings are your only choice

1. Haskell binding is not mentioned at http://curl.haxx.se/libcurl/
can we do something to fix it?

2. for me, any C library is ok because i need to work with memory
buffers directly

3. i don't need comprehensive support. at least just now i want to use
as minimum functionality as possible in order to not inflate EXE size



-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe