@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:
let NonEmptyList = ./NonEmptyList/Type
let extend = (./NonEmptyList/comonad).extend
let extract = (./NonEmptyList/comonad).extract
let map = (./NonEmptyList/functor).map
let f : Natural → Natural = λ(x : Natural) → x
let nel : NonEmptyList Natural = { head = 1, tail = [ 2, 3, 4 ] }
in { left =
map Natural Natural f nel
, right =
extend
Natural
Natural
(λ(x : NonEmptyList Natural) → 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.
@MonoidMusician and I were discussing
NonEmptyList/comonadin slack, and it seems like it's not working as intended. In particular, thetailis always an empty list. It seems like the coherence withFunctordoesn'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
extendalways throws me for a loop. So if someone wants to PR, go for it.