Skip to content
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

Add an option to print out what is in the context #46

Open
melrief opened this issue Aug 12, 2013 · 0 comments
Open

Add an option to print out what is in the context #46

melrief opened this issue Aug 12, 2013 · 0 comments

Comments

@melrief
Copy link
Collaborator

melrief commented Aug 12, 2013

The user should be able to query Hawk about the context of the user expressions.

For instance, if user's prelude.hs is:

{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Bool as B
import Data.List (length)

l = length

then the user query should return:

> hawk -q
{-# LANGUAGE OverloadedStrings -#}
data B.Bool = B.False | B.True
B.&& :: Bool -> Bool -> Bool
B.not :: Bool -> Bool
B.otherwise :: Bool
B.|| :: Bool -> Bool -> Bool
l :: [a] -> Int
length :: [a] -> Int

the output of the query should be readable by the user and is useful to understand what is the context.
The output of -q can be very long and we should think about how to organize it. For example, we could put data structure before function declarations, or we can have different options to toggle language extensions, data structures, functions...:

> hawk -q functions
B.&& :: Bool -> Bool -> Bool
B.not :: Bool -> Bool
B.otherwise :: Bool
B.|| :: Bool -> Bool -> Bool
l :: [a] -> Int
length :: [a] -> Int

This is an improvement and can be very helpful when the user configuration grows.

A bonus of such an option is to use this system not only to show to the user the context but also to do a sanity check on ambiguities:

import Data.List (length)
import Prelude (length)
> hawk --sanity-check
length is ambiguous: it is imported by both Data.List and Prelude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant