haskell / haskell/core-libraries-committee

RequiredTypeArgument variants of coerce from Data.Coerce

Open
#386 15 comments 5 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
109
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Usage of `coerce` quite frequently requires `TypeApplications` (or other mechanisms of specifying a type signature), which can get unwieldy quickly. I propose to add the following helpers to `Data.Coerce` to make this more ergonomic:

```haskell
{-# INLINE coerceFrom #-}
coerceFrom :: forall a -> forall b. Coercible a b => a -> b
coerceFrom _ = coerce

{-# INLINE coerceTo #-}
coerceTo :: forall a. forall b -> Coercible a b => a -> b
coerceTo _ = coerce

{-# INLINE coerceBetween #-}
coerceBetween :: forall a -> forall b -> Coercible a b => a -> b
coerceBetween _ _ = coerce
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading README.md and PROPOSALS.md, then examine the proposed coerceFrom, coerceTo, and coerceBetween entry points in Data.Coerce. Done would require resolving the proposal and establishing whether these helpers should be added, along with the implementation and validation expected by the project.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.