Skip to content

Eval plugin reports "Ambiguous type variable" where ghci does not. #1591

Closed
@fmehta

Description

@fmehta

Which lsp-client do you use:
VS Code

Steps to reproduce

Type -- >>> head []in the editor and click on Evaluate...

Expected behaviour

Output:
*** Exception: Prelude.head: empty list
as in ghci.

Actual behaviour

Output:

-- Ambiguous type variable ‘f0’ 
-- prevents the constraint ‘(Show f0)’ from being solved.
-- Probable fix: use a type annotation to specify what ‘f0’ should be.
-- These potential instances exist:
--   instance Show a => Show (ZipList a)
--     -- Defined in ‘Control.Applicative’
--   instance Show NestedAtomically
--     -- Defined in ‘Control.Exception.Base’
--   instance Show NoMethodError -- Defined in ‘Control.Exception.Base’
--   ...plus 215 others
--   (use -fprint-potential-instances to see them all)

Workaround

Specifying a concrete type, such as -- >>> head ([]::[Int]) does not result in this error, but is not pretty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions