I am trying to implement a dictionary in Haskell and I see that the data type must be
data Rel a b = a :-> b
but I don't see what it means, I think it's the same thing as key-value or similar
Looks like :->
is just a fancy constructor name:
Prelude> data Rel a b = a :-> b
Prelude> :t (5 :-> 6)
(5 :-> 6) :: (Num a, Num b) => Rel a b
In this code, 5 :-> 6
produces a Rel
value.
One could've used data Rel a b = a :-% b
instead, for example, where :-%
would be the constructor name.
One could also have used a non-operator such as
data Rel a b = MkRel a b
and:t MkRel 5 6
.