You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@MonoidMusician and I were discussing NonEmptyList/comonad in slack, and it seems like it's not working as intended. In particular, the tail is always an empty list. It seems like the coherence with Functor doesn't match. We hope that map f x = extend (\x -> f (extract x)) x, but it doesn't seem to:
letNonEmptyList=./NonEmptyList/Typelet extend = (./NonEmptyList/comonad).extend
let extract = (./NonEmptyList/comonad).extract
letmap= (./NonEmptyList/functor).maplet f :Natural→Natural= λ(x :Natural) → x
let nel :NonEmptyListNatural= { head=1, tail= [ 2, 3, 4 ] }
in { left =mapNaturalNatural f nel
, right =
extend
NaturalNatural
(λ(x :NonEmptyListNatural) → f (extract Natural x))
nel
}
$ dhall <<< ./bunk.dhall
{ left =
{ head = 1, tail = [ 2, 3, 4 ] }
, right =
{ head = 1, tail = [] : List Natural }
}
I was going to send a PR, but extend always throws me for a loop. So if someone wants to PR, go for it.
The text was updated successfully, but these errors were encountered:
@MonoidMusician and I were discussing
NonEmptyList/comonad
in slack, and it seems like it's not working as intended. In particular, thetail
is always an empty list. It seems like the coherence withFunctor
doesn't match. We hope thatmap f x = extend (\x -> f (extract x)) x
, but it doesn't seem to:I was going to send a PR, but
extend
always throws me for a loop. So if someone wants to PR, go for it.The text was updated successfully, but these errors were encountered: