Opened 20 months ago

Last modified 6 months ago

#8708 new bug

Kind annotation in tuple not parsed

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Consider this:

{-# LANGUAGE KindSignatures #-}

foo :: (Int, Int :: *)
foo = undefined

HEAD reports

/Users/rae/temp/Bug.hs:5:18: parse error on input ‛::’

Changing the line to

foo :: (Int, (Int :: *))

fixes the problem. Note the extra parentheses.

Change History (1)

comment:1 Changed 6 months ago by thomie

What about the following:

  • unboxed tuples: (# Int, Int :: * #)
  • lists: [ Int :: * ]
  • parallel arrays: [: Int :: * :]
  • default declarations: default ( Int :: * )

Currently all of those don't allow types with kind annotation but without parenthesis. They only allow ctypes:

-- A ctype is a for-all type
ctype	:: { RdrNameHsType }
	: 'forall' tv_bndrs '.' ctype	{ mkHsForAllTy (Just $2) [] $4 }
	| context '=>' type		{ mkHsForAllTy Nothing   $1 $3 }
	-- A type of form (context => type) is an *implicit* HsForAllTy
	| type				{ $1 }

Implementation wise it would be nice to keep doing the same for all: either allow kind annotation without parenthesis, or keep the status quo (since 2002).

Note: See TracTickets for help on using tickets.