Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider exporting all the things via Internal module and/or export a bit more #7

Closed
pacak opened this issue Jun 9, 2019 · 2 comments

Comments

@pacak
Copy link

pacak commented Jun 9, 2019

I keep doing strange things. Consider something like this:

data Foo = Foo { int :: Int, bool :: Bool } deriving (Generic, ...)

-- uses Read instances to populate corresponding fields
fromPairs :: [(String, String)] -> HKD Foo Maybe

fromPairs [] == Foo Nothing Nothing
fromPairs [("int", "10")] = Foo (Just 10) Nothing
fromPairs [("bool", "False)] = Foo Nothing (Just False)

Implementation uses label internally and since it requires HKD structure f as input I'm using it as label (mempty :: HKD Foo (Const ())). Now, any attempt to make it for any structure fails since required constraint (Monoid tuple, Generic xs, Tuple f xs tuple) => Monoid (HKD xs f) can't be expressed without Tuple class that's not exported.

Something-something internals something (if they could be exposed).

https://stackoverflow.com/questions/9190638/how-why-and-when-to-use-the-internal-modules-pattern

@i-am-tom
Copy link
Owner

Aah, absolutely! I think Tuple is probably actually useful enough to be exported through the front door, rather than the back door for internals. I'll expose it now, and try to figure out what is left that could come through an internals module :)

@i-am-tom
Copy link
Owner

This is now hopefully fixed in master, and I'll push to Hackage shortly :) Can't guarantee I'll have too much time this week for sorting out an internals module, but I'll do my best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants