hlint icon indicating copy to clipboard operation
hlint copied to clipboard

incorrect suggestion to use `newtype` instead of `data` for unlifted datatypes

Open MangoIV opened this issue 2 years ago • 2 comments

Bug

type Wrap :: UnliftedType -> Type 
data Wrap a = Wrap a

triggers "Use newtype instead of data" which is incorrect (this is also true for the opposite direction, i.e. Type -> UnliftedType

hlint version

λ ι hlint --version
HLint v3.5, (C) Neil Mitchell 2006-2022

Note It is not sufficient to actually look for things suffixed with # because a. it's a convention b. we have a UnliftedDataTypes extension

MangoIV avatar Mar 20 '23 12:03 MangoIV

It's OK for HLint to follow conventions, because this is really a tool about making people follow more conventions. Is this something that came up in practice for you? Or just a thought experiment?

ndmitchell avatar Apr 02 '23 20:04 ndmitchell

It came up in practise. I have a data family I which can be of kind UnliftedType to Type but that has to be a data, not a newtype. It's not terribly important though as i guess it's not occurring to often

MangoIV avatar Apr 02 '23 22:04 MangoIV