[Haskell-cafe] Problem w/YAHT code example
michael rice
nowgate at yahoo.com
Fri May 29 00:01:26 EDT 2009
Thanks! I just copied the code from the PDF file. Whatever that character was it wasn't the correct one.
Michael
--- On Thu, 5/28/09, Andrew Wagner <wagner.andrew at gmail.com> wrote:
From: Andrew Wagner <wagner.andrew at gmail.com>
Subject: Re: [Haskell-cafe] Problem w/YAHT code example
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Thursday, May 28, 2009, 10:01 PM
I'm not sure what you're using at the end of the identifier "search'", but it needs to be the single quote that's on the same key as the double quotes. I suspect that's where it's blowing up.
On Thu, May 28, 2009 at 9:56 PM, michael rice <nowgate at yahoo.com> wrote:
This code, from YAHT (Section 8.4.2, PDF pg. 119 of 192) seems to have a problem. Code below.
Michael
=================
[michael at localhost ~]$ ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> :l graph
[1 of 1] Compiling Main ( graph.hs, interpreted )
graph.hs:6:24: lexical error at character '\8217'
Failed, modules loaded: none.
==============
Prelude> data Graph v e = Graph [(Int,v)] [(Int,Int,e)]
search :: Graph v e -> Int -> Int -> Maybe [Int]
search g@(Graph vl el) src dst
| src == dst = Just [src]
| otherwise = search’ el
where search’ [] = Nothing
search’ ((u,v,_):es)
| src == u =
case search g v dst of
Just p -> Just (u:p)
Nothing -> search’ es
| otherwise = search’ es
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090528/e113d07c/attachment.html
More information about the Haskell-Cafe
mailing list