lens / lens-aeson

Traversals and Prisms for Data.Aeson
MIT License
51 stars 18 forks source link

"Typed Holes" #13

Closed Quantumplation closed 9 years ago

Quantumplation commented 9 years ago

This may be a misunderstanding on my part, and if so, I apologize.

Because some of the identifiers in this library begin with underscores, GHC 7.8.3 is picking them up as "Typed Holes" whenever I use them.

01:05:02 /d/proj/Haskell/RunscopeExport$ cabal build
Building RunscopeExport-0.1.0.0...
Preprocessing executable 'RunscopeExport' for RunscopeExport-0.1.0.0...
[1 of 1] Compiling Main             ( Main.hs, dist\build\RunscopeExport\RunscopeExport-tmp\Main.o )

Main.hs:52:64:
    Found hole `_Value'
      with type: (Maybe Value -> Const (Maybe Value) (Maybe Value))
                 -> BL.ByteString -> Const (Maybe Value) BL.ByteString
    Relevant bindings include
      response :: Response BL.ByteString (bound at Main.hs:51:5)
      url :: ByteString (bound at Main.hs:50:9)
      bKey :: ByteString (bound at Main.hs:49:5)
      uuid :: ByteString (bound at Main.hs:48:12)
      getDetails :: ByteString -> IO Value (bound at Main.hs:48:1)
    In the second argument of `(.)', namely `_Value'
    In the second argument of `(^.)', namely `responseBody . _Value'
    In the second argument of `($)', namely
      `response ^. responseBody . _Value'

Do I need to (somehow?) disable typed holes?

shachaf commented 9 years ago

No, you just need to have them in scope. GHC replaces the regular "not in scope" error with a hole when an identifier begins with _, but if it's in scope it should find it.

glguy commented 9 years ago

You'll need to import Data.Aeson.Lens. If you already did this you might need to add _Value to the import list.

Quantumplation commented 9 years ago

Ah, sorry, I see now! Sorry for being a bit of a noob :)