Commit 585ff572 authored by Ian Lynagh's avatar Ian Lynagh

Remove some more unused functions

parent 90054502
......@@ -11,7 +11,6 @@ module ListSetOps (
-- Association lists
Assoc, assoc, assocMaybe, assocUsing, assocDefault, assocDefaultUsing,
mkLookupFun, findInList, assocElts,
-- Duplicate handling
hasNoDups, runs, removeDups, findDupsEq,
......@@ -66,15 +65,12 @@ Inefficient finite maps based on association lists and equality.
-- A finite mapping based on equality and association lists
type Assoc a b = [(a,b)]
assocElts :: Assoc a b -> [(a,b)]
assoc :: (Eq a) => String -> Assoc a b -> a -> b
assocDefault :: (Eq a) => b -> Assoc a b -> a -> b
assocUsing :: (a -> a -> Bool) -> String -> Assoc a b -> a -> b
assocMaybe :: (Eq a) => Assoc a b -> a -> Maybe b
assocDefaultUsing :: (a -> a -> Bool) -> b -> Assoc a b -> a -> b
assocElts xs = xs
assocDefaultUsing _ deflt [] _ = deflt
assocDefaultUsing eq deflt ((k,v) : rest) key
| k `eq` key = v
......@@ -91,30 +87,6 @@ assocMaybe alist key
lookup ((tv,ty):rest) = if key == tv then Just ty else lookup rest
\end{code}
@mkLookupFun eq alist@ is a function which looks up
its argument in the association list @alist@, returning a Maybe type.
@mkLookupFunDef@ is similar except that it is given a value to return
on failure.
\begin{code}
mkLookupFun :: (key -> key -> Bool) -- Equality predicate
-> [(key,val)] -- The assoc list
-> key -- The key
-> Maybe val -- The corresponding value
mkLookupFun eq alist s
= case [a | (s',a) <- alist, s' `eq` s] of
[] -> Nothing
(a:_) -> Just a
findInList :: (a -> Bool) -> [a] -> Maybe a
findInList _ [] = Nothing
findInList p (x:xs) | p x = Just x
| otherwise = findInList p xs
\end{code}
%************************************************************************
%* *
\subsection[Utils-dups]{Duplicate-handling}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment