haskell-beam / haskell-beam/beam

NUMERIC, Scientific, NaN

Open
#651 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

A Postgresql NUMERIC value can be NaN, but a Haskell Scientific value cannot.

However, `numeric` links NUMERIC to Scientific. What can I do if I want to use NUMERIC columns with NaN values?

The next best thing I can do is to make the column nullable, but I would rather simply use NaN since Postgresql allows it.

`decimal` does what I want except that I am trying to use decimal fixed-point numbers, which Scientific affords, not binary floating-point numbers.

If instead of:
```
numeric :: BeamSqlBackend be => Maybe (Word, Maybe Word) -> DataType be Scientific
```
there is:
```
numeric :: BeamSqlBackend be => Maybe (Word, Maybe Word) -> DataType be (Maybe Scientific)
```

Then NaN could be represented as `Nothing` and my immediate problem would be fixed, though +/-Inf would still be problematic.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.