yes - I can do that, but it is tedious to issue each command, and I may not remember what all the types are called
(I know that :browse will tell me what things exist in the current module with a capital letter)
Also I want to be able to do this for a file different to the one currently loaded in GHCi.
Something along the lines of (assuming a unix shell):
$> showtypes MyBigMonsterHaskellFile.hs
data X = A | B
type Name = String
newtype Y = Z Name
(maybe with a blank line for each one..)
Has no-one rustled up something like this - or do I need to look into Haskell parsing...?
> On 4 May 2017, at 16:30, Kevin Quick <[hidden email]> wrote:
> You can use ghci's browse:
> $ ghci
> Prelude> import Data.Maybe
> Prelude Data.Maybe> :browse Data.Maybe
> Prelude Data.Maybe> :l MyFile.hs
> MyFile Data.Maybe> :browse MyFile
> Andrew Butterfield writes:
>> Dear Haskellers,
>> any quick and easy way to extract all the type declarations from a Haskell source file?
>> (for easy reference)
>> Andrew Butterfield
>> School of Computer Science & Statistics
>> Trinity College
>> Dublin 2, Ireland
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post.
School of Computer Science & Statistics
Dublin 2, Ireland