ekmett / ekmett/linear

Use generalized Boolean for Epsilon

Open
#88 3 comments 0 reactions 0 assignees View on GitHub
api-change feature request performance question
Dominant language
Haskell
Stars
220
Forks
55
PR merge metrics
No merged PRs in 30d

Description

In [GPipe](https://hackage.haskell.org/package/GPipe), and many other shader DSLs, you use lifted numeric types for shader expressions (in GPipe for example a Float is lifted to [S V Float](https://hackage.haskell.org/package/GPipe-2.0.1/docs/Graphics-GPipe-Expr.html#t:S) in the vertex shader). These lifted shader values cannot be evaluated in the non-lifted world, which is why I use the [Boolean package](https://hackage.haskell.org/package/Boolean) for lifted booleans.

The Epsilon class has the nearZero member that returns (a non-lifted) Bool, thus making it impossible to use for shader DSLs like GPipe. Some unfortunate consequences of this is that functions like lookAt and normalize also cannot be used directly in shader code.

If Epsilon were using the generalized booleans from the Boolean package it would enable linear to be more fully usable in the lifted shader domain.

Related to this is also the many functions in the Linear.Quaternion package that has a constraint on RealFloat. This class has several members that return (unlifted) Bools and thus cannot be implemented for GPipes shader types. But I guess asking for dropping that constraint is pushing it :)

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.