duckling-0.2.0.0: A Haskell library for parsing text into structured data.
Safe HaskellNone
LanguageHaskell2010

Duckling.DistanceUnits.Types

Description

This module shadows names of some units previously defined in Types. Therefore, the units from that module must be used qualified by module.

Synopsis

Documentation

data ContextualDistance Source #

Supports deferred resolution of ambiguous units. Note that this sum type cannot be simply replaced by "Maybe (ContextualDistance Double DeferrableUnit)" (with Nothing representing Nonrelatable). See "NOTE A" below.

Constructors

Nonrelatable

If two different ambiguous units were to be composed, then it would not be possible to decide which to resolve to. As of today, this won't happen since for now M is the lone ambiguous unit.

ContextualDistance Double DeferrableUnit 

Instances

Instances details
Semigroup ContextualDistance Source #

When both Metric and Imperial units are given, resolve to Metric. Otherwise, preserve the original measurement system and use the smaller unit. For the purpose of this resolution, all Metric units are considered "smaller" than Imperial units.

Instance details

Defined in Duckling.DistanceUnits.Types

toSystemUnit :: Unit -> DeferrableUnit Source #

Disambiguation of original Unit type

toRawUnit :: DeferrableUnit -> Unit Source #

Reconversion to original Unit type