bbarker
bbarker

Reputation: 13108

Cannot apply expression of type to a visible type argument when using Data.Proxy?

In one of my modules where I have the let expression:

let persist = mkCassEntityPersist (Proxy @SxRecord) cassCliSt

This gives an error:

    • Cannot apply expression of type ‘t1’
      to a visible type argument ‘SxRecord’
    • In the first argument of ‘mkCassEntityPersist’, namely
        ‘(Proxy @SxRecord)’
      In the expression: mkCassEntityPersist (Proxy @SxRecord) cassCliSt
      In an equation for ‘persist’:
          persist = mkCassEntityPersist (Proxy @SxRecord) cassCliSt
   |
43 |   let persist = mkCassEntityPersist (Proxy @SxRecord) cassCliSt
   |                                      ^^^^^^^^^^^^^^^

However, in another module, with a subset of the GHC language extensions used in the first, I am perfectly ok to do this:

recTypeRep :: TypeRep
recTypeRep = typeRep $ Proxy @SxRecord

Is there a way to address the issue? The meaning of the error message is not that clear to me either at the moment.

Upvotes: 4

Views: 286

Answers (1)

bbarker
bbarker

Reputation: 13108

In this particular case, an import Data.Proxy had been forgotten.

Upvotes: 3

Related Questions