commands, we could add a flag to enhance :type's output.
Would it be overkill to have two flags, one that enabled showing the full type + specializations, and a "newbie mode" flag that only showed a few specializations?
Daniel.
Idris> :doc map
Prelude.Functor.map : Functor f => (m : a -> b) -> f a -> f b
Apply a function across everything of type 'a' in a
parameterised type
The function is Total
Idris> :doc length
Prelude.List.length : List a -> Nat
Compute the length of a list.
Runs in linear time
The function is Total
Prelude.Strings.length : String -> Nat
Returns the length of the string.
> length ""
0
> length "ABC"
3
The function is Total
On Mon, May 2, 2016, at 13:39, Richard Eisenberg wrote:
>
> On May 2, 2016, at 4:36 PM, Eric Seidel <er...@seidel.io> wrote:
>
> > Also, I'd suggest making (1) and (2) optional flags for :type rather
> > than new top-level commands. The shared prefix already suggests a common
> > purpose, printing out the type of something, so why not make it even
> > clearer that (1) and (2) are just specializations (heh) of :type?
>
> Others have echoed this and I'm open to the idea. But I, personally,
> dislike this. All three commands are useful, and I expect I'll want to
> frequently interleave which one I want during a GHCi session. Controlling
> via a flag makes this awkward.
>
> But that's just my 2¢.
Ah, I was talking about a different kind of flag this time.
Instead of a GHCi-level flag (or maybe in addition to..), I was thinking
about a flag specifically associated with an invocation of :type, e.g.
ghci> :type length
Foldable t => t a -> Int
ghci> :type -default length
[a] -> Int
It's very nitpicky, I know, but I think the added grouping would be
nice, in particular w.r.t. the output of :help.
> :type-at <loc> show the type of expression at <loc>
> :loc-at <loc> return the location of the identifier at <loc>
> :all-types return a list of all types in the project including
with <loc> = <filename> <line> <col> <end-line> <end-col> <text>