-
Notifications
You must be signed in to change notification settings - Fork 100
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
Why aren't constructors exported out of Internal libraries #342
Comments
We should fix this. We should also offer a |
@treeowl I'm staging a regular expression compiler. I switched to instance (Lift k, Lift v) => Lift (M.HashMap k v) where
lift m = [| M.fromList m' |]
where
m' = M.toList m
liftTyped = unsafeTExpCoerce . lift I'm hoping if I instead just use |
We won't be able to "just" derive instance (Lift k, Lift v) => Lift (M.HashMap k v) where
liftTyped m = [|| M.fromList m' ||]
where
m' = M.toList m to avoid the ugly and unnecessary unsafety. |
@madgen I've opened a PR. As it is right now, the internal arrays are realized as lists and converted. I imagine that will lead to more compact code than trying to produce code to actually construct the arrays by poking elements into arrays one by one. However, I'd be happy to experiment with alternative approaches if you find it's taking too long to build the maps at run-time. |
As I commented in the PR #343, it might well be that using See https://well-typed.com/blog/2020/06/th-for-static-data/ Please benchmark whether |
@phadej compared to the Unfortunately even with monomorphisation, I couldn't get Note that the performance of unstaged versions of both I'll try benchmarking with the |
Hi, I'm trying to derive
Lift
instances forHashMap
andHashSet
as done in th-lift-instances forSet
andMap
fromcontainers
(specifically here) so that I can use them with Typed Template Haskell.However, deriving
Lift
as an orphan instance requires access to the constructors which I'd expect from theInternal
version of theHashSet
andHashMap
modules but that is not the case.HashMap
partially exposes it, however, it uses types such asHashMap.Array.Array
which doesn't expose its constructors.Is there a reason for this?
The text was updated successfully, but these errors were encountered: