ndmitchell / ndmitchell/hlint

Is it possible to add HLint rule to require INLINABLE

Open
#994 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
1.6k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

Say I have type-class

class Foo a where
   foo :: MonadFoo m => m a

I'd want to require that all foo = bindings have {-# INLINABLE foo #-} (or INLINE) in the same scope. AFAIU this cannot be implement as user hint.

instance Foo Int where
    foo = ...
    {-# INLINABLE foo #-}

I'll be perfectly happy if all foo = should have {-# INLINABLE foo #-} attached, independencly if they are actually instance methods or not. It would be my problem to turn false positives (I doubt I'll have local variables named foo e.g.).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how HLint represents user hints and how it identifies function bindings and pragmas. Define the rule's scope from the examples: report bindings named foo that lack an attached INLINABLE or INLINE pragma, including instance methods, and add coverage for the shown class and instance forms.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.