[Haskell-beginners] How to access non-exported function from Data.Set?

Chaddaï Fouché chaddai.fouche at gmail.com
Thu Jun 2 12:02:42 CEST 2011


On Wed, Jun 1, 2011 at 10:56 PM, Christoph Bussler <chbussler at aol.com> wrote:
> Hi,
>
>
>
> In Data.Set there is a function splitLookup
>
>
>
> splitLookup :: Ord a => a -> Set a -> (Set a,Maybe a,Set a)
>
>
>
> that is not exported, but would precisely give me the functionality that I
> need. Not sure why it is not exported, but is there a way to use it?

No but splitMember is exported and give you strictly the same
functionality, if you really want to rewrite splitLookup, you can just
do :

> splitLookup x s = let (inf, b, sup) in (inf, if b then Just x else Nothing, sup)

-- 
Jedaï



More information about the Beginners mailing list