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 7218043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:25:52+00:00 2026-05-28T21:25:52+00:00

I’m just reading Dependent Types at Work . In the introduction to parametrised types,

  • 0

I’m just reading Dependent Types at Work. In the introduction to parametrised types, the author mentions that in this declaration

data List (A : Set) : Set where
  []   : List A
  _::_ : A → List A → List A

the type of List is Set → Set and that A becomes implicit argument to both constructors, ie.

[]   : {A : Set} → List A
_::_ : {A : Set} → A → List A → List A

Well, I tried to rewrite it a bit differently

data List : Set → Set where
  []   : {A : Set} → List A
  _::_ : {A : Set} → A → List A → List A

which sadly doesn’t work (I’m trying to learn Agda for two days or so, but from what I gathered it’s because the constructors are parametrised over Set₀ and so List A must be in Set₁).

Indeed, the following is accepted

data List : Set₀ → Set₁ where
  []   : {A : Set₀} → List A
  _::_ : {A : Set₀} → A → List A → List A

however, I’m no longer able to use {A : Set} → ... → List (List A) (which is perfectly understandable).

So my question: What is the actual difference between List (A : Set) : Set and List : Set → Set?

Thanks for your time!

  • 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-28T21:25:52+00:00Added an answer on May 28, 2026 at 9:25 pm

    I take the liberty to rename the data types. The first, which is
    indexed on Set will be called ListI, and the second ListP,
    has Set as a parameter:

    data ListI : Set → Set₁ where
      []  : {A : Set} → ListI A
      _∷_ : {A : Set} → A → ListI A → ListI A
    
    data ListP (A : Set) : Set where
      []  : ListP A
      _∷_ : A → ListP A → ListP A
    

    In data types parameters go before the colon, and arguments after the
    colon are called indicies. The constructors can be used in the same
    way, you can apply the implicit set:

    nilI : {A : Set} → ListI A
    nilI {A} = [] {A}
    
    nilP : {A : Set} → ListP A
    nilP {A} = [] {A}
    

    There difference comes when pattern matching. For the indexed version we have:

    null : {A : Set} → ListI A → Bool
    null ([]  {A})     = true
    null (_∷_ {A} _ _) = false
    

    This cannot be done for ListP:

    -- does not work
    null′ : {A : Set} → ListP A → Bool
    null′ ([]  {A})     = true
    null′ (_∷_ {A} _ _) = false
    

    The error message is

    The constructor [] expects 0 arguments, but has been given 1
    when checking that the pattern [] {A} has type ListP A
    

    ListP can also be defined with a dummy module, as ListD:

    module Dummy (A : Set) where
      data ListD : Set where
        []  : ListD
        _∷_ : A → ListD → ListD
    
    open Dummy public
    

    Perhaps a bit surprising, ListD is equal to ListP. We cannot pattern
    match on the argument to Dummy:

    -- does not work
    null″ : {A : Set} → ListD A → Bool
    null″ ([]  {A})     = true
    null″ (_∷_ {A} _ _) = false
    

    This gives the same error message as for ListP.

    ListP is an example of a parameterised data type, which is simpler
    than ListI, which is an inductive family: it “depends” on the
    indicies, although in this example in a trivial way.

    Parameterised data types are defined on the
    wiki
    ,
    and
    here
    is a small introduction.

    Inductive families are not really defined, but elaborated on in the
    wiki

    with the canonical example of something that seems to need inductive
    families:

    data Term (Γ : Ctx) : Type → Set where
      var : Var Γ τ → Term Γ τ
      app : Term Γ (σ → τ) → Term Γ σ → Term Γ τ
      lam : Term (Γ , σ) τ → Term Γ (σ → τ)
    

    Disregarding the Type index, a simplified version of this could not be
    written with in the Dummy-module way because of lam constructor.

    Another good reference is Inductive
    Families

    by Peter Dybjer from 1997.

    Happy Agda coding!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.