Unusual views and data constructors

I don’t know how I didn’t notice this, but data constructors and function definitions cannot use types with types other than *, and these are options * -> *, etc., because of the (->)kind signature is even for -XPolyKinds.

Here is the code I tried:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}

data Nat = S Nat | Z

data Foo where
  Foo :: 'Z -> Foo -- Fails

foo :: 'Z -> Int -- Fails
foo _ = 1

The error I am getting is the following:

<interactive>:8:12:
    Expected a type, but ‘Z’ has kind ‘Nat’
    In the type signature for ‘foo’: foo :: 'Z -> Int

Why should we not allow the comparison of samples with non-traditional species?

+3
source share
1 answer

1 , " , *". * - , Int - , ; , ; , " ".


1 , unbox-.

+4

All Articles