[Haskell-cafe] Problem w/YAHT code example

michael rice nowgate at yahoo.com
Thu May 28 21:56:03 EDT 2009


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







      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090528/29e34413/attachment.html


More information about the Haskell-Cafe mailing list