- Home
- Software
- Threads FAQ
- A glossary of terms used in threaded programming
- About the multithreaded programming FAQ
- After I create a certain number of threads, my program crashes [Unix]
- Asynchronous thread cancellation [Unix]
- How can I perform a join on any non-specific thread? [Unix]
- Mixing threads and signals [Unix]
- The history of threads
- What are the main families of threads?
- What is a thread?
- Why are reentrant library and system call interfaces good?
Is there a copy’n’paste error in
Prelude> dropPrefix “foolish” “football”
(“lish”, “ball”)
which should rather be
Prelude> dropPrefix “foolish” “football”
(“lish”, “tball”)
?
I don’t know about newer GHCs, but in 6.8.1, dropPrefix “foo” “foobar” gives a pattern match error (since left becomes [] after some time).
Also, what is the “after” function for?
Marc: presumably ‘after’ was the original name of dropPrefix. Rename it, and the function starts working.
The ‘otherwise’ line is unnecessary, btw.
Oops, thanks for noticing those thinkos, gentlemen. That’s what I get for composing a post at midnight!
Instead of writing your own ‘dropPrefix’, there is also the standard ‘stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]’, which you can also use with view patterns:
{-# LANGUAGE ViewPatterns #-}
genbankHeader (stripPrefix “>gi|” -> Just rest) = muddle rest