Is Hask locally small?

前端 未结 3 1042
遥遥无期
遥遥无期 2021-02-08 05:36

Is the category Hask of haskell objects an example of a locally small category?

http://ncatlab.org/nlab/show/locally+small+category

Maybe not.. hask as cpo htt

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 06:21

    Especially @PhillipJF, here's a try. I'm not trying to make the most accurate or elegant model of Hask, I'm just trying to make a model. Critique, please.

    If A is a Haskell type, define a value of type A in Hask to be an equivalence class of well-typed Haskell terms of type A (strings x for which x :: A would be accepted by the type checker), modulo extensional equality. That is, two terms are considered equal if they expand out to the same (possibly infinite) normal form, and two terms which have no hnf are also equal. The fact that this is not decidable is irrelevant, we need only state these conditions set-theoretically, which I have little doubt we can do.

    Let the objects of Hask be Haskell types (primitive types & user-defined types; we will assume that all user-definable types exist and have distinct names. User-defined type definitions are source code, so they are countable. Just name them D0,D1, ... according to that counting.).

    Let the morphisms A -> B be values of type A -> B

    Let the identity on A be the equivalence class of id :: A -> A, and similarly let composition of g and f be the equivalence class of g . f.

    The set of all values is a countable set, because terms are just strings over a finite alphabet. So this model of Hask is small.

    Is this wrong?

提交回复
热议问题