exporting events generated by makeAcidic

12 views
Skip to first unread message

Bob Hutchison

unread,
May 17, 2013, 2:15:22 PM5/17/13
to HAppS
Hi,

Is there a way to export the events/data constructors generated by makeAcidic? I've tried several variations with all but two ending up with anything from an out of scope data constructor to orphaned instance errors.

As it stands now I'm having to take one of two approaches:
- export everything in the module (e.g. "module MyModule where").
- define synonyms for the data constructors generated by makeAcid and export those.

The synonym approach is the best that I've come up with but is ugly and annoying since you have to keep the signature up-to-date if you're going to define a top-level signature for the synonym.

My knowledge of the available options in Haskell seems pretty shaky just now, any help will be appreciated. I know it has to do with template Haskell and when it's run (i.e. after the module declaration.) I've been running in circles and at this point, I expect the solution to be embarrassingly obvious.

Thanks,
Bob

Jeremy Shaw

unread,
May 17, 2013, 2:24:48 PM5/17/13
to HAppS
I'm not sure I understand the problem/question. Can't you just do:

module MyAcid (MyState(..), MyEvent(..)) where

data MyState = ...

myEvent :: Query MyState Int
myEvent = ...

$(makeAcidic ''MyState ['myEvent])

- jeremy
> --
> You received this message because you are subscribed to the Google Groups "HAppS" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to happs+un...@googlegroups.com.
> To post to this group, send email to ha...@googlegroups.com.
> Visit this group at http://groups.google.com/group/happs?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Bob Hutchison

unread,
May 17, 2013, 2:31:17 PM5/17/13
to ha...@googlegroups.com
Thanks! BTW, that's kinda what I meant by "embarrassingly obvious" :-(

Cheers,
Bob
Reply all
Reply to author
Forward
0 new messages