fresheyeball_ 2017-02-25 20:59:07
Why is (Map k) not Alternative?
pikajude 2017-02-25 21:07:27
I don't think you can define Applicative (Map k)
EvanR 2017-02-25 21:10:20
why the heck not
c_wraith 2017-02-25 21:15:05
What does pure do?
EvanR 2017-02-25 21:29:29
Map is Functor
EvanR 2017-02-25 21:29:54
map has no Ord constraint
EvanR 2017-02-25 21:30:22
but yeah pure wont work
nshepperd 2017-02-25 21:33:36
pure _ = Map.empty :: Map Void a
pikajude 2017-02-25 21:33:58
pure _ = Map.empty :: Map a b
pikajude 2017-02-25 21:34:01
we've solved it!
nshepperd 2017-02-25 21:34:27
you could do (Enum k, Bounded k, Ord k) => Applicative (Map k)
pikajude 2017-02-25 21:34:36
how to define pure
nshepperd 2017-02-25 21:34:43
but it would be horribly slow and fill you with regret
nshepperd 2017-02-25 21:35:34
pure x = Map.fromList [(k, x) | k <- [minBound..maxBound]]
ongy 2017-02-25 21:42:38
do that with Data.Map.Strict for extra fun
ongy 2017-02-25 21:50:27
does that even need to be Strict? The lazy list is strict in it's keys right? Does that one build the structure in an eager way?
nshepperd 2017-02-25 21:50:27
Lazy vs Strict Map only affects the values
nshepperd 2017-02-25 21:50:27
keys are always evaluated
nshepperd 2017-02-25 21:50:27
I think there might be some laziness in the tree itself, not sure