Re: [Haskell-cafe] ghc -e

2010-01-13 Thread Henning Thielemann
On Wed, 6 Jan 2010, Gwern Branwen wrote: On Wed, Jan 6, 2010 at 7:23 PM, Tony Morris wrote: ghc -e "import Control.Monad; forM [[1,2,3]] reverse" As of 6.10.2, the bug whereby the GHC API lets you use functions from anywhere just by naming them (Java-style) has not been fixed: $ ghc -e "Co

Re: [Haskell-cafe] ghc -e

2010-01-06 Thread Jason Dagit
On Wed, Jan 6, 2010 at 6:15 PM, Reid Barton wrote: > On Thu, Jan 07, 2010 at 10:23:35AM +1000, Tony Morris wrote: > > Can I import a module when using ghc -e? > > > > e.g. ghc -e "import Control.Monad; forM [[1,2,3]] reverse" > > One option is to create a file "imports.hs" which contains the text

Re: [Haskell-cafe] ghc -e

2010-01-06 Thread Gwern Branwen
On Wed, Jan 6, 2010 at 7:35 PM, Tony Morris wrote: > Gwern Branwen wrote: >> On Wed, Jan 6, 2010 at 7:23 PM, Tony Morris wrote: >> >>> ghc -e "import Control.Monad; forM [[1,2,3]] reverse" >>> >> >> As of 6.10.2, the bug whereby the GHC API lets you use functions from >> anywhere just by naming t

Re: [Haskell-cafe] ghc -e

2010-01-06 Thread Reid Barton
On Thu, Jan 07, 2010 at 10:23:35AM +1000, Tony Morris wrote: > Can I import a module when using ghc -e? > > e.g. ghc -e "import Control.Monad; forM [[1,2,3]] reverse" One option is to create a file "imports.hs" which contains the text "import Control.Monad", and then run ghc -e "forM [[1,2,3]] r

Re: [Haskell-cafe] ghc -e

2010-01-06 Thread Tony Morris
Gwern Branwen wrote: > On Wed, Jan 6, 2010 at 7:23 PM, Tony Morris wrote: > >> ghc -e "import Control.Monad; forM [[1,2,3]] reverse" >> > > As of 6.10.2, the bug whereby the GHC API lets you use functions from > anywhere just by naming them (Java-style) has not been fixed: > > $ ghc -e "Co

Re: [Haskell-cafe] ghc -e

2010-01-06 Thread Gwern Branwen
On Wed, Jan 6, 2010 at 7:23 PM, Tony Morris wrote: > ghc -e "import Control.Monad; forM [[1,2,3]] reverse" As of 6.10.2, the bug whereby the GHC API lets you use functions from anywhere just by naming them (Java-style) has not been fixed: $ ghc -e "Control.Monad.forM [[1,2,3]] reverse" package f

[Haskell-cafe] ghc -e

2010-01-06 Thread Tony Morris
Can I import a module when using ghc -e? e.g. ghc -e "import Control.Monad; forM [[1,2,3]] reverse" -- Tony Morris http://tmorris.net/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Rodrigo Queiro
interact :: (String -> String) -> IO () is a very handy function for ghc -e, e.g. ghc -e 'interact $ lines . map (show . (*2) . read) . unlines' will multiply the number on every line by 2. (interact takes a function which maps from entire input to entire output) On 05/11/2007, Graham Fawcett <[

Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Brent Yorgey
On Nov 5, 2007 2:41 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote: > On Nov 5, 2007 1:46 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Is there a way to run 'ghc -e' taking input > > from standard input? I would like to use it > > in a pipe. > > It seems to me that you can use getContent

Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Graham Fawcett
On Nov 5, 2007 1:46 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to run 'ghc -e' taking input > from standard input? I would like to use it > in a pipe. It seems to me that you can use getContents, et. al., as you would from any other Haskell program: $ echo hello there mauri

Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Brent Yorgey
On Nov 5, 2007 1:46 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to run 'ghc -e' taking input > from standard input? I would like to use it > in a pipe. > xargs ought to do the trick nicely. -Brent ___ Haskell-Cafe mailing list Has

[Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Maurí­cio
Hi, Is there a way to run 'ghc -e' taking input from standard input? I would like to use it in a pipe. Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe