Using makeLens with Gloss gives "can't load framework: OpenGL (not found)"

291 views Asked by At
System: Mac OS X Big Sur
ghc : 8.8.4
cabal: 3.2.0.0

I can install all gloss-examples and run without issues.

But when I use makelens ''Foo

It suddenly complains:

<command line>: can't load framework: OpenGL (not found)

I tried with microlens and same behavior.

Why?

Below are the codes I've used:

{-# LANGUAGE TemplateHaskell #-}

import           Control.Lens                       hiding (element)
import           Graphics.Gloss
import           Graphics.Gloss.Interface.Pure.Game


data ManGame = ManGame {
  mgPic :: Picture,
  mgX   :: Float,
  mgY   :: Float
  -- Add _mgKeyDown to have press and hold function
                       } deriving Show
--makeLenses ''ManGame

This works. But if I uncommented the last line, it reports error during compilation.

For the cabal file(I've used the same as with other gloss-examples programs):

Executable gloss-game
  Main-is:        Main.hs
  hs-source-dirs: picture/Game

  Build-depends:
          base                          >= 4.8 && < 5
        , lens
        , gloss                         == 1.13.*

  Default-Language:
        Haskell2010

  ghc-options:
        -O2
        -Wall
        -threaded
        -rtsopts
0

There are 0 answers