GitXplorerGitXplorer
m

hashtag-coerce

public
17 stars
3 forks
0 issues

Commits

List of commits on branch master.
Verified
7a8da32600a0a38dd27bdcc960cb971d4620e6bc

Merge pull request #1 from ulysses4ever/patch-1

mmpickering committed 6 years ago
Verified
aec3074f53564cfd248e97b4cf2b9e4efcc5d985

Typo

uulysses4ever committed 6 years ago
Unverified
45c723d028ef34b96c672325e38c55dba932ff3e

Remove old file

mmpickering committed 7 years ago
Unverified
78e4652dcaaf97e9c7013d1c1a707ae4dd63e400

Move readme

mmpickering committed 7 years ago
Unverified
c24b4efe0688bfd7586f2577aa554140aa50a09d

Rename

mmpickering committed 7 years ago
Unverified
efe4f81bf104fd49e1efe3a266faf1652ecf5a41

Documentation

mmpickering committed 7 years ago

README

The README file for this repository.

hashtag-coerce is a GHC source plugin which detects opportunities to use coerce.

At the moment it just detects one simple example, where we are mapping a newtype constructor over a list. Operationally, this will traverse the list and apply the newtype constructor at each position.

For example,

newtype Baz = Baz Int

qux :: [Int] -> [Baz]
qux = map Baz

will cause the plugin to warn that the map Foo can be replaced with coerce.

src/ModuleA.hs:6:7: warning:
    The usage of 'map' can be replaced with coerce.
  |
6 | qux = map Baz
  |       ^^^^^^^

The plugin can only be used with GHC 8.6.1 which is scheduled to be released at the end of June.

In order to run the plugin, add hashtag-coerce as a dependency and compile with -fplugin=HashtagCoerce.