On further thought, better to use the Maybe afterall. You can use Nothing
to signify your False and Just to signify your result.
case p1 s of
Just result -> result
Nothing -> case p2 s of ...
That's probably more intuitive to what you were intending.
Chris.
On Wed, 21 May 2008
On Wed, 21 May 2008, HP Wei wrote:
>
> Suppose p1, p2, p3 are 3 predicates
> that take an input -- say, a String.
> They return either (True, result)
> or False.
>
> I want to get an effect like in this expression:
>
> case p1 s of
>(True, r) -> r
>False -> case p2 s of
>
Hi Pepe,
> The result of an expression is not a String, but an arbitrary value of
> some type.
Yes, sorry I forgot to mention that I will also be evaluating expressions
of type Bool in this context.
> One way to do that (untested):
> ...
Thanks for that. I had to modify it a bit to typecheck an
Hello,
I want to use the ghc evaluator on the fly for some refactorings within
HaRe. However, I notice that runstmt ::Session -> String -> IO RunResult.
Is there anyway I can grab the result of the evaluated expression as a
String (rather than it being outputted to the terminal)?
It seems RunRes
Hi Simon,
> Yes I do, please! Would you feel up to doing so? I'm sure Simon'd check
> your text for veracity!
I have modified the wiki, and added a new section under "initialisation":
http://www.haskell.org/haskellwiki/GHC/As_a_library
Would it also be appropriate to modify that wiki page to
Simon,
> The GHC API is behaving just like --make: it links the program if you
> have a Main module. To ask it not to link, you want to do the same as
> '--make -c', which in the GHC API means setting the ghcLink field of
> DynFlags to NoLink.
Thanks, this has solved the problem I was having. I
Hello,
I am trying to use the API to interpret a Main module and get some type
information from it. However, everytime I try to load a "Main.hs" module
using the API I get the following error message:
/usr/local/packages/ghc-6.8.2/lib/ghc-6.8.2/libHSrts.a(Main.o): In
function `real_main':
Main.c:
Hi,
It seems that GHC's API interface has changed between 6.6 and 6.8. Most
notably, JustTypecheck and GHC.dropForAlls are no longer in scope.
Are the changes documented anywhere? The notes on the hackage commentary
still seem to point to the previous API internals.
http://hackage.haskell.org/tr
> runghc finds ghc in the path, so it might be using a ghc from /usr/bin
> or somesuch. Try compiling Setup with ghc 6.8.2 instead
> (ghc --make Setup).
Excellent, that worked a treat! thanks.
Chris.
>
>
> Thanks
> Ian
>
>
___
Glasgow-haskell-users mai
> Looks like your version of cabal is a bit old. Try updating to the 1.2.3
> or 1.3 series. You can find it on hackage.haskell.org
I'm using the runghc command from ghc-6.8.2, is that right?
[EMAIL PROTECTED] ~/filepath-1.0 $ which runghc
/usr/local/packages/ghc-6.8.2/bin/runghc
Cheers,
Chris
Thanks for everyone's help with this so far. However, I'm having some
problems using cabal:
Whenever I try to
runghc Setup.hs install
a cabal file (I've tried parsec and network) I get an error message
similar to this:
Setup.hs: parsec.cabal:15: Unknown field 'build-type'
I tried to install Ca
Hi,
I have just built and installed ghc-6.8.2 on my linux box but I can't find
the network package. Has it been moved or left out?
Kind regards,
Chris.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailm
Ian,
> Is there a way for GHC on OS X to find where it was run from, so that it
> can find package.conf?
The command:
ghc --print-libdir
should do it.
Cheers,
Chris.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://ww
Hi Tope,
> When I tried to compile it as instucted on the webpage ( $ ghc -o hello
> hello.hs), I got this error message.
are you actually typing in that '$' into the command prompt? try leaving
out the '$' and just type "ghc -o hello hello.hs".
Chris.
_
Hi Kenny,
>
> \begin{code}
>
> main = do
> session <- GHC.newSession GHC.JustTypecheck (Just "Test.hs")
>
> dflags1 <- GHC.getSessionDynFlags session
> (dflags2, packageIds) <- Packages.initPackages dflags1
> GHC.setSessionDynFlags session dflags2{GHC.hscTarget=GHC.HscNothing}
>
>
Hi,
I was wondering if there was an easy way to pretty print the result of the
type checker from GHC. I basically want the format that GHCi spits out,
rather than a type annotation with qualified types. I know I can knock up
a parser that removes the qualifiers, but I was wondering if there was a
Hi Simon,
> Mainly this is due to modularity: many of the library packages can be built
> entirely separately from GHC, so their configure scripts are designed to be
> standalone.
>
Yes, I guess it would be a fair bit of work to have it check that you are
building the whole of GHC as opposed to s
Hi,
I've noticed that when you run ./configure on a ghc build lot's of
repetition occurs. A lot of the time the same checks are being performed for
each configure file in the ghc hierarchy. Could it be possible if some of
these checks could be done once at a high level and then subsequent
configur
Hello,
I've been trying to build the ghc-devel package (6.7) from macports.
However the build seems to fail half through. Specifically when running
the setup for base-2.1:
configure: Using compiler: ../../compiler/ghc-inplace
configure: Compiler flavor: GHC
configure: Compiler version: 6.7.200704
Hi,
I was wondering when ghc-6.6.1 will be released? I am asking because a
patch has been made to the ghc repo to allow multple calls to the
ghc.newSession within the API and HaRe depends on this.
Regards,
Chris.
___
Glasgow-haskell-users mailing list
G
Hi,
I have recently tried to compile the 6.6 version of ghc from the darcs
repository.
I followed the intructions to pull ghc from the repository:
darcs get --partial http://darcs.haskell.org/ghc-6.6/ghc
cd ghc
chmod +x darc-add
./darcs-add -extra pull
The build process seems to get past stage
line everything works. Something very subtle that
I compeletely overlooked.
Thanks for your help.
Chris.
On Sat, 25 Nov 2006, Ian Lynagh wrote:
>
> Hi Chris,
>
> On Fri, Nov 10, 2006 at 04:15:10PM +0000, C.M.Brown wrote:
> >
> > I am currently in the process of por
Hi,
I am currently in the process of porting some of the Haskell
Refactorer (HaRe) over to ghc 6.6. Part of HaRe requires the API and until
now I've been content with using th 6.5 API. However, since I've started
the switch I've noticed some strange problems and the latest is I am
getting the foll
Hi Greg,
I have just been trying to install ghc 6.6 using Darwin Ports, but the
search facility can't find ghc-6.6. :
sudo port selfupdate
DarwinPorts base version 1.320 installed
Downloaded MacPorts base version 1.320
The MacPorts installation is not outdated and so was not updated
selfupdate do
24 matches
Mail list logo