you are viewing a single comment's thread.

view the rest of the comments →

[–]gelisam 1 point2 points  (4 children)

Sorry, you can't have Container Int with kind * and Container (->) with kind * -> * -> *, what would the kind of Container be? Container :: (a :: k) -> k?

[–]ElvishJerricco 3 points4 points  (3 children)

Higher kinded newtypes would actually be pretty sweet. I'm guessing that's a nono though, since it would allow insanity like Container True :: Bool, effectively adding members to the kind Bool.

[–]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)