Am Freitag, 7. Oktober 2016 18:06:05 UTC+2 schrieb Russel Winder:
>
> I believe Haskell has: 
>
>     import Data.Map (insertWith', empty, filter, elems, keys) 
>
> I tried: 
>
>     import Data.HashMap (insertWith, empty, filter, elems, keys) 
>
> on the grounds that there is no Map but it seems empty, filter, and 
> elems are not defined functions, just insertWith and keys are defined.


We use `values` instead of `elems`
`empty` cannot be imported, because it is a class member (of type class 
ListEmpty, this is a Frege-ism). Since this comes through the Prelude, it 
is already there. The import will supply the instance of ListEmpty for 
HashMap, so `empty` should do the right thing.
There is no `filter` (to my knowledge, it isn't available in Haskell 
either? Since this would mean that you'd shadow the standard filter that 
works on Lists.)
But we have
filterValues :: (v -> Bool) -> HashMap k v -> HashMap k v
filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v






Hence, what you want could be achieved by the following import:

   import frege.Prelude hiding(filter)
   import Data.HashMap (insertWith, filterValues filter, values elems, keys)





 

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to