
#16185: Add an AnonArgFlag to FunTy -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In Trac #15952 Richard and I agreed that it makes sense to add a flag to `FunTy` to distinguish `(->)` from `(=>)`. This ticket tracks progress. See [ticket:15952#comment:7] and [ticket:15952#comment:8]. Main changes: * Define `AnonArgFlag` in `Var`, alongside `ArgFlag` {{{ data AnonArgFlag = VisArg -- Used for (->): an ordinary non-dependent arrow -- The argument is visible in source code | InvisArg -- Used for (=>): a non-dependent predicate arrow -- The argument is invisible in source code }}} * `Type` looks like this {{{ data Type = ... | FFunTy -- ^ t1 -> t2 Very common, so an important special case -- FFunTy for "full function type"; see pattern synonym for FunTy { ft_af :: AnonArgFlag -- Is this (->) or (=>)? , ft_arg :: Type -- Argument type , ft_res :: Type } -- Resuult type }}} * Add a uni-directional pattern synonym for the old `FunTy` {{{ pattern FunTy :: Type -> Type -> Type pattern FunTy arg res <- FFunTy { ft_arg = arg, ft_res = res } }}} Everything else follows routinely. A huge win is that `isPredTy` vanishes almost completely. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16185 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler