Skip to content

Opt for Num and Fractional type, and more #1

Description

@AliceRixte

Hi there !

Thank you for this library, this is almost exactly what I needed.

However, it would be great if one could use Opt with Int (or any other Num type, or Rationaltype, and so on so forth).

This is possible by changing Opt to :

data Opt (def :: k) a where
  Def :: forall {k} def a. SingDef def a => Opt (def :: k) a
  Some :: forall {k} def a. a -> Opt (def :: k) a

and then define what the conversion function is for each kind via the class

class SingKind k => SingDef (def :: k) a where
  demoteDef :: a

What do you think ?

I made a PR #2 that showcases what I mean.

Cheers !

Alice

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions