[Haskell-beginners] associative arrays

Karl Voelker ktvoelker at gmail.com
Sat Aug 25 08:44:16 CEST 2012


On Fri, Aug 24, 2012 at 10:05 PM, Christopher Howard
<christopher.howard at frigidcode.com> wrote:
> What is typically used in Haskell circles to provide associative array
> functionality? (I.e., key-value type arrays.) I'm not really looking for
> efficiency so much as interface convenience. Obviously I could code it
> myself based on lists or something, but I don't want to reinvent the wheel.
>

In simple situations, "coding it yourself" doesn't require much of any
code, since the Prelude comes with a lookup function for lists of
pairs:

lookup :: Eq a => a -> [(a, b)] -> Maybe b

-Karl V.



More information about the Beginners mailing list