record-dot-preprocessor icon indicating copy to clipboard operation
record-dot-preprocessor copied to clipboard

doesn't work in ghci

Open l29ah opened this issue 5 years ago • 1 comments

I've tried ghci with RecordDotPreprocessor (0.2.6) on GNU/Linux, but it doesn't seem to work at all (doesn't fail to load though):

‰ ghci -ignore-dot-ghci -fplugin=RecordDotPreprocessor -XOverloadedStrings -XFlexibleInstances -XIncoherentInstances -XMagicHash -XBangPatterns -XFlexibleContexts -XTypeApplications -XDeriveGeneric -XScopedTypeVariables -XDuplicateRecordFields -XDataKinds -XMultiParamTypeClasses -XTypeSynonymInstances
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Prelude> data A = A {a::Int}
Prelude> (A 666).a

<interactive>:2:2: error:
    • Couldn't match expected type ‘Int -> c’ with actual type ‘A’
    • Possible cause: ‘A’ is applied to too many arguments
      In the first argument of ‘(.)’, namely ‘(A 666)’
      In the expression: (A 666) . a
      In an equation for ‘it’: it = (A 666) . a
    • Relevant bindings include
        it :: A -> c (bound at <interactive>:2:1)
Prelude> :t (.a)
(.a) :: (Int -> c) -> A -> c

l29ah avatar Aug 31 '20 01:08 l29ah

Does it work with those definitions in a file? It may well be that plugins aren't applied in the ghci prompt, which wouldn't be too surprising (I've never checked either way, and on Windows, it doesn't work at all). To get that fixed would require GHC to adjust how plugins work - feel free to raise a GHC feature request.

ndmitchell avatar Aug 31 '20 09:08 ndmitchell