4 ms·
No I didn't understand every sub-function in this function. That isn't necessary to get an idea of what a function does. All of your questions can be answered i
by rowanG077 4y ago
No I didn't understand every sub-function in this function. That isn't necessary to get an idea of what a function does. All of your questions can be answered incredible quickly though using https://hoogle.haskell.org/ https://hoogle.haskell.org/
> What does Optics.rewriteOf do?
Hoogling show this is an alias of https://hackage.haskell.org/package/lens-5.1.1/docs/Control-Lens-Combinators.html#v:rewriteOf https://hackage.haskell.org/package/lens-5.1.1/docs/Control-....
> What's the purpose of Lint.useToMap?
Hoogle again shows https://hackage.haskell.org/package/dhall-1.41.1/docs/Dhall-Lint.html#v:useToMap https://hackage.haskell.org/package/dhall-1.41.1/docs/Dhall-.... If your function is not indexed you can look at what is qualified as `Lint` and look it up that way.
> How about D.subExpressions ? How does that composition work with the loop function?
https://hackage.haskell.org/package/dhall-1.41.1/docs/Dhall-Core.html#v:subExpressions https://hackage.haskell.org/package/dhall-1.41.1/docs/Dhall-... All nicely documented... I'm not sure what you mean by composition with the loop function. First the loop function is executed and then afterwards over the result the expression in the first argument to fmap is applied. There is no weird interaction going on here. It's just run this over the result of the loop function if it didn't produce an error.
> Even better. How would you go about finding the source code containing the definition of the function `D.subExpressions` ?
Use hoogle or just look at the imports at the top of the file. Just like any other programming language. Or even better, use the language server to find it for you. For example there is an import here:
`import qualified Dhall.Core as D`
Now you know that function is in the `Dhal.Core` module. Going to that module you see the function is not actually there but is exported from the `Dhal.Syntax` module. It took me literally 5 seconds to find it: https://github.com/dhall-lang/dhall-haskell/blob/master/dhall/src/Dhall/Syntax.hs#L786 https://github.com/dhall-lang/dhall-haskell/blob/master/dhal...
- spion 4y ago> Hoogling show this is an alias of https://hackage.haskell.org/package/lens-5.1.1/docs/Control- https://hackage.haskell.org/package/lens-5.1.1/docs/Control-... That explains nothing? What does it do? How does it do it? What do the type variables `a b a b` mean? Why are there 4 of them? What is ASetter?
- spion 4y agoOh the documentation of Setter is fun: https://hackage.haskell.org/package/lens-5.1.1/docs/Control-Lens-Combinators.html#t:Setter https://hackage.haskell.org/package/lens-5.1.1/docs/Control-... Absolutely nothing explained whatsoever. Yup, sounds like like the typical, familiar Haskell experience of zero useful docs where you need them.
- axman6 4y agoThis argument is literally “the documentation for this domain I don’t understand is bad because I refuse to learn the domain”. I use the lens library all the time and those docs make perfect sense, particularly if you apply just the teensiest bit of logic and thing “Could a setter, perhaps, set something?”. It’s a DSL, and you don’t understand the domain - I’m sure you’d have a great time explaining this function from LLVM without referring to any other part of the documentation to give it context https://llvm.org/doxygen/group__LLVMCCoreValueInstructionGetElementPointer.html#ga1e623a49010f40ef27a4a7a955648898 https://llvm.org/doxygen/group__LLVMCCoreValueInstructionGet.... What’s a GEP? Under the rules you’re applying to the lens documentation, I’m not allowed to look that up, because it should be immediately obvious.
- spion 4y agoYes they actually document which bit is what > Get the source element type of the given GEP operator Notice the relentness repetition that provides precision and clarity? I now know the argument GEP is a GEP operator. Might seem redundant, but it allows a new reader to start from any point and find their way to the relevant terms / nouns and their types.
- rowanG077 4y agoThe documentation of lenses is geared towards people know what lenses are. Of course this single fragment of documentation doesn't make sense if you don't know what lenses are. If you want to understand what lenses are the package links to a helpful wiki and tutorial: https://github.com/ekmett/lens/wiki/Overview https://github.com/ekmett/lens/wiki/Overview All within reach within seconds of discovering the function. To understand any tool you must understand the libraries and tools it to some degree. Your questions here are not Haskell specific, and the answers to the question you asked are easy to find. I'm not familiar with the Dhall code base and was able to answer you within minutes.