Erroneous assumption about lambda precedence in generated code
bwbush opened this issue · comments
Brian W Bush commented
Code like
instance
iMaybeHashable : ⦃ i : Hashable a ⦄ → Hashable (Maybe a)
iMaybeHashable {{_}} .hash Nothing = MakeHash ∘ hashBytes $ hash iUnitHashable tt
iMaybeHashable {{i}} .hash (Just x) = MakeHash ∘ hashBytes $ hash iPairHashable (tt , x)
{-# COMPILE AGDA2HS iMaybeHashable #-}
becomes the uncompilable
instance (Hashable a) => Hashable (Maybe a) where
hash Nothing = MakeHash . \ r -> hashBytes r $ hash ()
hash (Just x) = MakeHash . \ r -> hashBytes r $ hash ((), x)
instead of the correct
instance (Hashable a) => Hashable (Maybe a) where
hash Nothing = MakeHash . (\ r -> hashBytes r) $ hash ()
hash (Just x) = MakeHash . (\ r -> hashBytes r) $ hash ((), x)
Jesper Cockx commented