Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,830
    • Issues 4,830
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18407

Closed
Open
Created Jun 29, 2020 by LeanderK@trac-LeanderK

Type-Level floats

Motivation

!3583 (merged) motivates me to actually write a feature request. Currently, there are type-level Nats, but I would like to have actual type-level floats. I am currently writing a linear-algebra library where I want to track certain things like the basis on the type-level and I would need to cross the type/term or term/type boundary (and the term-representation is via floats).

Proposal

Some relevant discussion can be found on #8697, where the focus is on rationals and not on floats, but I think both can go hand in hand. I think to implement such a feature one would need to figure out the parsing and adding floats to type-lits, but i am not a ghc-developer so I am not sure.

Ideally, I would imagine something like:

data Blah (num:: Float) = Blah

f :: forall num. KnownFloat num => Blah num -> Float
f = ...

g = f @1.3
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking