[personal profile] sassa_nf
(Background: https://stackoverflow.com/questions/69360027/list-set-should-be-a-sort-but-it-isnt)

So what's the deal with List A = ⊤ + A × List A?

Here's a list of types translated into a product of types:
map : List Set → Set
map [] = ⊤
map (A ∷ t) = A × (map t)

The catch is that (A × ...) is a type, and (A ∷ ...) isn't. Seems to me that List and component-wise product are not the same after all... A little weird.

Maybe it's obvious to some.

Date: 2021-10-11 11:51 am (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
I wonder what happens if we translate this into Idris.

Date: 2021-10-12 09:37 am (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
and what does the compiler say about it?

Date: 2021-10-12 10:09 am (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
But in dependent types we have the same language of terms on both sides of ":", there should be no real distinction between constructing a type and constructing a value. This is fine in Idris:
x : fst (swap (23, Int))
x = 42

Even this:
x : let p = (23, Int) in fst (swap p)
x = 42


So I understand why Idris is fine with your code but don't understand why Agda is unhappy. I don't know Agda though.
Edited Date: 2021-10-12 10:11 am (UTC)

Date: 2021-10-12 11:31 am (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
Don't you just lose information in `List Type -> Type`? Given this type signature, all we know about the result of `mmm xs` is that it's some Type and nothing more. So we can't extract anything. It's not really about lists vs. tuples.

You can still extract `a` from `(a,b)` if you know it's `(a,b)`.
Edited Date: 2021-10-12 11:32 am (UTC)

Date: 2021-10-13 10:21 am (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
I'd say yes but I really don't know the mechanics of Idris & Agda well enough to continue.

Date: 2021-10-13 01:39 pm (UTC)
thedeemon: (Default)
From: [personal profile] thedeemon
My point is these are not two distinct worlds (apart from level number in universes hierarchy).

Profile

sassa_nf

January 2026

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 23rd, 2026 10:12 am
Powered by Dreamwidth Studios