8000 `closed` as the division remainder · Issue #9 · freckle/closed · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
closed as the division remainder #9
Open
@mjgpy3

Description

@mjgpy3

I'm working with times (:grimacing:) and I'd like to go from something like akin to

newtype QuantityOfMinutes = QuantityOfMinutes Natural

to something like

data HoursWithLeftOverMinutes = HoursWithLeftOverMinutes {
  hours :: Natural
  , leftOverMinutes :: Closed 0 59
}

Whether or not dealing with time is something I should be doing, it struck me that it should be safe to construct a Closed as the remainder of a division.

divWithRemainder
  :: Natural
  -- ^ Divisor
  -> (Natural,   Closed 0 _numerator)
  --  ^ Result    ^ Remainder

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

      0