the announcement of the true-name package is pretty funny
groups.google.com/forum/#!topic/haskell-cafe/...Posted Jan 12, 2016, 5:53 AM UTC
308
Posted Jan 12, 2016, 5:53 AM UTC
Yay, now we can hide our .Internal modules! /s :D
This is deep, dangerous magic... just like in the Inheritance cycle! http://inheritance.wikia.com/wiki/True_name
Haven't tried it, but this should be really nice for deriving generic for some things. I've run into this problem a lot, trying to do a syb traversal on an AST that stores its source as PrettyPrint.Doc
Uhhhh huh..
Does this kind of information hiding actually deliver boons w.r.t. things like optimization? Why not take Guido's "consenting adults" approach to begin with and allow something like "unsafe import" to depend on unexported functions? With advice that you can expect no upstream support if you do choose to do this.
That's exactly the deal with
.Internalmodules, but it's social convention and comments rather than a language keyword. I prefer it this way, frankly, as we also have.Unsafe, or.ThisIsWrong, or what have you, which strongly encourage some consultation of the documentation to understand the many facets of the world of pain you are stepping into.When it's solely a matter of a library that you are maintaining and someone somewhere else unaffiliated with you is breaking the invariants to their own ends, that's fine, what they are doing is irrelevant and if something goes wrong it's only their headache.
But if you both work for the same organization, and you build something and take the time to ensure there are invariants that hold, they're probably important and your code may in fact need them to hold to make sense. Then someone else comes along and rips apart the internals and changes with things to make their code work in a very hacky and un-haskell-like fasion, and returns data to you with the invariants you so carefully preserved all violated and your code is now apparently broken. Now you have a headache.
Remember, 90% of everything is crud, including programmers and even co-workers. Much of Haskell's power comes from the kinds of invariants you can guarantee, not from pretty please asking people not to break them unless it's really convenient.
One difference here from something like Python is that this would be obvious. You'd need to enable
unsafe importand it'll show up in the code.