[Haskell-cafe] Problem w/YAHT code example
wagner.andrew at gmail.com
Thu May 28 22:01:03 EDT 2009
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 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe