Haskell Language Common functors as the base of cofree comonads Cofree Maybe ~~ NonEmpty

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Given

data Maybe a = Just a
             | Nothing

we have

data Cofree Maybe a
     = a :< Just (Cofree Maybe a)
     | a :< Nothing

which is isomorphic to

data NonEmpty a
     = NECons a (NonEmpty a)
     | NESingle a


Got any Haskell Language Question?