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

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


On Thu, Jun 2, 2011 at 12:02 PM, Chaddaï Fouché
<chaddai.fouche at gmail.com> wrote:
> 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)
>

oops, I obviously meant :

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

And for what you want :

> yourSplit x s =  let (inf, b, sup) = splitMember x s in if b then Right x else Left (findMax inf, findMin sup)

-- 
Jedaï



More information about the Beginners mailing list