kowainik / kowainik/stan

Inspection on too restrictive SPECIALIZE

Open
#361 0 comments 1 reaction 0 assignees View on GitHub
inspection nice to have :nail_care:
Dominant language
Haskell
Stars
597
Forks
53
PR merge metrics
No merged PRs in 30d

Description

If you have a function of type:

```haskell
foo :: MonadIO m => m a
```

then the following specializations are either useless or too restrictive:

```haskell
{-# SPECIALIZE foo :: MonadIO m => m () #-}
{-# SPECIALIZE foo :: IO () #-}
```

The only correct one is:

```haskell
{-# SPECIALIZE foo :: IO a #-}
```

But since GHC doesn't warn on such cases, it's useful for Stan to provide such type of analysis.

Contributor guide

Open the contributing guide

Research direction

Start by locating Stan's analysis of GHC SPECIALIZE pragmas and compare it with the examples in the issue. Add checks for useless or overly restrictive specialization signatures, including the three shown cases, and verify that the valid IO a specialization is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.