e-mail addr: [EMAIL PROTECTED]
hugs-version: 1.4 version 970410
configuration options: none
operating system: irix 6.2 & linux
compiler: irix `cc' compiler & gcc 2.7.2
expected behaviour:"a" `isPrefixOf` "b" == False
observed behaviour:"a" `isPrefixOf` "b" == True
session transcript:
     ___    ___   ___    ___   __________   __________                        
     /  /   /  /  /  /   /  /  /  _______/  /  _______/       Hugs 1.4         
    /  /___/  /  /  /   /  /  /  / _____   /  /______                          
   /  ____   /  /  /   /  /  /  / /_   /  /______   /  The Nottingham and
Yale
  /  /   /  /  /  /___/  /  /  /___/  /  _______/  /    Haskell User's
System 
 /__/   /__/  /_________/  /_________/  /_________/         Version 970410

   Copyright (c) The University of Nottingham and Yale University,
1994-1997.
    Bug reports: [EMAIL PROTECTED]   Web:
http://www.haskell.org/hugs.

Reading file "/home/neon/tweed/hugs/lib/Prelude.hs":
                   
Hugs session for:
/home/neon/tweed/hugs/lib/Prelude.hs
Type :? for help
Prelude> :l List
Reading file "/home/neon/tweed/hugs/lib/List.hs":
Reading file "/home/neon/tweed/hugs/lib/Maybe.hs":
Reading file "/home/neon/tweed/hugs/lib/List.hs":
                   
Hugs session for:
/home/neon/tweed/hugs/lib/Prelude.hs
/home/neon/tweed/hugs/lib/Maybe.hs
/home/neon/tweed/hugs/lib/List.hs
List> "a" `isPrefixOf` "b"
True
List> "a" `isSuffixOf` "b"
True


***important note***
I'm providing the above just because you asked for it. The problem is in
the List file which defines isPrefixOf by

isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
isPrefixOf [] _          = True
isPrefixOf (x:xs) (y:ys) = x == y || isPrefixOf xs ys

whereas 2nd eqn should be

isPrefixOf (x:xs) (y:ys) = x == y && isPrefixOf xs ys

isSuffixOf is then automatically fixed. (I can't reach the library webpage
to see if this bug is present in the original library version or just the
hugs one.)

David Tweed
-------------------------------------------------------------------
homepage: http://www.cs.bris.ac.uk/~tweed/  work tel: 0117) 9545104
"... we think mathematics is fun and we aren't ashamed to admit the
 fact."           -- Donald Knuth, Ronald Graham and Oren Patashnik


Reply via email to