[Haskell-cafe] hs-boot and (micro)lenses
Francesco Ariis
fa-ml at ariis.it
Thu Aug 2 18:32:32 UTC 2018
Hello cafe,
I have some problem setting up an appropriate .hs-boot module.
I attach a .tar.gz'd cabal folder, so you can immediately test it
with `cabal new-repl`.
I had a file like this
-- datatypes
data A = A { _i :: Int,
_b :: B }
type AS a = State A a
data B = B (AS ())
makeLenses ''A
-- functions
f :: B
f = B $ i .= 18
So I decided to split it up in 2 files to test hs-boot in the wild:
-- A.hs
-------
data A = A { _i :: Int,
_b :: B }
type AS a = State A a
makeLenses ''A
-- B.hs
-------
data B = B (AS ())
f :: B
f = B $ i .= 18
Well, I don't know how to write A.hs-boot. I tried this:
module A where
import Lens.Micro.Platform
data A
b :: Lens' A B
but ghc rightfully complains that he doesn't know about B, and if
I slap an `import B` in the .hs-boot then I have another import-cycle.
What's the way out of that?
The project I am dealing with is bigger than this problem and I would
really love to keep functions and related datatypes nearby for mental
sanity.
As I wrote above, attached you can find a .tar.gz with everything set
up to replicate this
-F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boot-lens-0.1.0.0.tar.gz
Type: application/gzip
Size: 13166 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180802/52542a5b/attachment.bin>
More information about the Haskell-Cafe
mailing list