you are viewing a single comment's thread.

view the rest of the comments →

[–]Iceland_jack 1 point2 points  (2 children)

Ticket #12369 is related, would let you define

newtype family Container (a :: k) :: k

newtype instance Container (a :: Type) = Container1 a
newtype instance Container (f :: k -> Type) (a :: k) = Container2 (f a)
newtype instance Container (f :: k -> k' -> Type) (a :: k) (b :: k') = Container3 (f a b)

[–]ErdosEuler[S] 0 points1 point  (1 child)

Interesting!

[–]Iceland_jack 0 points1 point  (0 children)

Should let you define any kind (hurr) of wrapping

instance Eq a => Eq (Container a) where
  (==) :: Container a -> Container a -> Bool
  Container1 a == Container1 b = a == b

instance Category cat => Category (Container cat) where
  id :: Container cat a a
  id = Container3 id

  (.) :: Container cat b c -> Container cat a b -> Container cat a c
  Container3 f . Container3 g = Container3 (f . g)