You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type checker produces non self-explanatory error in case of method instance is expressed through generic method in point-free style. My first thought was that generic function doesn't support recursive types, which is not the case and the type error is easily fixable by defining lazy argument.
To Reproduce
import Data.Generic.Rep (class Generic)
import Data.Show.Generic (genericShow)
import Prelude
data T = A Int | B Int T
derive instance Generic T _
instance showT :: Show T where
show = genericShow
Error:
The value of showT is undefined here, so this reference is not allowed.
PureScript(CycleInDeclaration)
Expected behavior
An ideal solution is to accept point free style as
instance showT :: Show T where
show x = genericShow x
but at least compiler should append to the error message something like: "Try to rewrite function without point-free style."
This is the error message I'd expect (and eta-expanding functions changes their semantics so we don't want to do that automatically), but that doesn't mean we can't enhance it.
Description
Type checker produces non self-explanatory error in case of method instance is expressed through generic method in point-free style. My first thought was that generic function doesn't support recursive types, which is not the case and the type error is easily fixable by defining lazy argument.
To Reproduce
Error:
Expected behavior
An ideal solution is to accept point free style as
but at least compiler should append to the error message something like: "Try to rewrite function without point-free style."
Additional context
#3807
PureScript version
0.15.8
The text was updated successfully, but these errors were encountered: