reflex-platform icon indicating copy to clipboard operation
reflex-platform copied to clipboard

problems when using makeLenses from Control.Lens.TH

Open dktr0 opened this issue 5 years ago • 4 comments

I'm trying to use makeLenses from Control.Lens.TH in a reflex-platform based project. I am using a very recent version of the reflex platform. When I include even a very simple example of using makeLenses, the build fails with this error (at the stage where GHCJS is linking Template Haskell):

Data.Binary.Get.runGet at position 1: Unknown encoding for constructor
CallStack (from HasCallStack):
  error, called at libraries/binary/src/Data/Binary/Get.hs:351:5 in binary-0.8.5.1:Data.Binary.Get

Here's a minimal example that fails in this way:

{-# LANGUAGE TemplateHaskell #-}
module SomeModule where

import Control.Lens
import Control.Lens.TH

data SomeType = SomeType { _someField :: Int }

$(makeLenses ''SomeType)

dktr0 avatar Aug 16 '19 16:08 dktr0

@dktr0 What operating system are you using? A binary encoding issue sounds like it could be system-level, though I'm not sure how makeLenses could cause it.

JBetz avatar Nov 26 '19 18:11 JBetz

Will have to check again since it's been a while - but my recollection is that this was probably happening on multiple OSes - Debian and OSX for example. Will try again though if you are confirming that it should be possible to use this. Thanks!

dktr0 avatar Nov 26 '19 18:11 dktr0

I know there have been issues using Template Haskell with ghcjs in the past, but the critical ones should be resolved now, and uses like makeLenses should definitely be possible. Let me know if it's still an issue and I'll investigate further if so.

JBetz avatar Nov 26 '19 18:11 JBetz

I just had the chance to check - still get the same error on both Debian 10 and OS X 10.14. This is using commit 6f73628ec6091b5b352ad7d224bf34cb0cb162ed of reflex-platform.

dktr0 avatar Dec 05 '19 22:12 dktr0

If anyone encounters this issue, please reopen.

ali-abrar avatar Dec 06 '23 03:12 ali-abrar