Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7694063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:13:59+00:00 2026-05-31T21:13:59+00:00

I am going through the Haskell wiki books GADTS https://en.wikibooks.org/wiki/Haskell/GADT guide. I was tracking

  • 0

I am going through the Haskell wiki books GADTS

https://en.wikibooks.org/wiki/Haskell/GADT guide.

I was tracking pretty well until a Kind signature was added which generalizes the constrained type of the Cons constructor.

data Safe
data NotSafe

data MarkedList             ::  * -> * -> * where
  Nil                       ::  MarkedList t NotSafe
  Cons                      ::  a -> MarkedList a b -> MarkedList a c

safeHead                    ::  MarkedList a Safe -> a
safeHead (Cons x _)          =  x


silly 0                      =  Nil
silly 1                      =  Cons () Nil
silly n                      =  Cons () $ silly (n-1)

With the Kind Signature I can use the Cons constructor to construct and pattern match against both Safe and Unsafe MarkedLists. While I understand what going on I am unfortunately having trouble building any intuition as to how the Kind Signature is allowing this. Why do I need the Kind Signature? What is the Kind Signature doing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:14:00+00:00Added an answer on May 31, 2026 at 9:14 pm

    The same way a type signature works for values, a kind signature works for types.

    f :: Int -> Int -> Bool
    f x y = x < y
    

    Here, f takes two argument values and produces a result value. The equivalent for types could be:

    data D a b = D a b
    

    The type D takes two argument types and produces a result type (it is * -> * -> *). For example, D Int String is a type (which has kind *). The partial application D Int has kind * -> *, just the same way the partial application f 15 has type Int -> Bool.

    So we could rewrite the above as:

    data D :: * -> * -> * where
      D :: a -> b -> D a b
    

    In GHCi, you can query types and kinds:

    > :type f
    f :: Int -> Int -> Bool
    > :kind D
    D :: * -> * -> *
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been going through a Haskell tutorial recently and noticed this behaviour when trying
I'm going through Real world Haskell , and got to the example: -- file:
I'm following Real World Haskell, and am going through chapter 2, where the exercise
I've been going through Haskell monoids and their uses , which has given me
I am going through Write Yourself a Scheme in Haskell . Its a great
I'm going through the 'Learn you a Haskell' tutorial and I am at this
I'm going through a Haskell tutorial and am given this piece of code to
I'm going through the problems in the Haskell O'Reilly book. The problem I am
How can exceptions be used in Haskell without going through IO ? I have
Going through the Active Support Core Extensions guide , it looks like some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.