Giter Site home page Giter Site logo

cantor-pairing's People

Contributors

bodigrim avatar identicalsnowflake avatar potato4444 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

potato4444

cantor-pairing's Issues

Missing instances for Word

Is it intentional that there is no instance for Word? there are instances for the fixed width word varieties and Int so it surprises me that the instance is missing.

Cardinality on type level

Is it possible to promote cardinality to the type level? Like,

data Cardinality = Finite Nat | Countable

class Cantor a where 
  type Measure a :: Cardinality
  ...

instead of

data Cardinality = Finite Integer | Countable 

class Cantor where 
  cardinality :: Cardinality
  ...

This would allow to distinguish between finite and countable on type level, eliminating the need in deriving an additional Finite typeclass. Constraint Finite a would be simply Measure a ~ Finite n.

Cardinality for mutually-recursive types

Current HEAD fails to detect cardinality of mutually-recursive types as Countable. Here is an example:

{-# LANGUAGE DeriveGeneric, TypeApplications #-}

import Cantor
import GHC.Generics

data Foo = FooNil | Foo Bool Bar deriving (Generic)
data Bar = BarNil | Bar Bool Foo deriving (Generic)

instance Cantor Foo
instance Cantor Bar

main = print $ cardinality @Foo
$ ghc MutualRec.hs && ./MutualRec
MutualRec: <<loop>>

I believe that this can be improved by keepind track of all encountered types (instead of only the last one) in the first argument of GCantor class, as a type-level list. Does it look worse pursuing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.