
#15621: Error message involving type families points to wrong location -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.10.1 Component: Compiler (Type | Version: 8.4.3 checker) | Resolution: | Keywords: TypeFamilies Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by pacak): One more example, figuring out why ghc complains on an innocent looking line took a bit of time. {{{ % cat foo.hs }}} {{{#!haskell module P (o_O) where import GHC.Types o_O :: Maybe Any o_O = do present <- pure True if present then undefined :: Maybe Int else undefined :: Maybe Int }}} {{{ % ghc -O foo.hs [1 of 1] Compiling P ( foo.hs, foo.o ) foo.hs:7:5: error: • Couldn't match type ‘Any’ with ‘Int’ Expected type: Maybe Any Actual type: Maybe Int • In a stmt of a 'do' block: present <- pure True In the expression: do present <- pure True if present then undefined :: Maybe Int else undefined :: Maybe Int In an equation for ‘o_O’: o_O = do present <- pure True if present then undefined :: Maybe Int else undefined :: Maybe Int | 7 | present <- pure True | ^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15621#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler