forked from haskell-hvr/missingh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.txt
More file actions
27 lines (20 loc) · 825 Bytes
/
notes.txt
File metadata and controls
27 lines (20 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
basename p = reverse $ takeWhile (/= '/') $ reverse p
dirname p = case reverse $ dropWhile (/= '/') $ reverse p of
[] -> "."
p' -> p'
--------------------------------------------------
From: Mark Carroll <mark@ixod.org>
Date: Sat, 15 Jan 2005 19:17:09 -0500 (EST)
To: John Goerzen <jgoerzen@complete.org>
Subject: Re: [Haskell-cafe] Re: Utility functions
You can take the original, or this version, as being Copyright (c) 2004
Mark Carroll under the modified BSD license. At the time of writing, it's
the one at http://www.opensource.org/licenses/bsd-license.php
splitListBy :: (a -> Bool) -> [a] -> [[a]]
splitListBy isElement =
unfoldr splitter . (ignored :)
where
splitter [] = Nothing
splitter xs = Just (span isElement (tail xs))
ignored = error "internal failure in splitListBy"
-- Mark