Skip to content

:info (->) inconsistent: Requires -> to be parenthesized but not <->

Summary

:info for the function arrow requires parentheses :info (->)

$ devbug
GHCi, version 8.11.0.20200403: https://www.haskell.org/ghc/  :? for help
Prelude>
Prelude> :i ->

<interactive>:1:1: error: parse error on input `->'
Prelude>
Prelude> :i (->)
type (->) :: * -> * -> *
data (->) a b
  	-- Defined in `GHC.Prim'
infixr -1 ->
instance Applicative ((->) r) -- Defined in `GHC.Base'
instance Functor ((->) r) -- Defined in `GHC.Base'
instance Monad ((->) r) -- Defined in `GHC.Base'
instance Monoid b => Monoid (a -> b) -- Defined in `GHC.Base'
instance Semigroup b => Semigroup (a -> b) -- Defined in `GHC.Base'
Prelude>
Prelude>

For any other "type operator" it doesn't matter

Prelude> :set -XTypeOperators
Prelude> data a <-> b = Iso (a->b) (b->a)
Prelude> :i <->
type (<->) :: * -> * -> *
data (<->) a b = Iso (a -> b) (b -> a)
  	-- Defined at <interactive>:3:1
Prelude> :i (<->)
type (<->) :: * -> * -> *
data (<->) a b = Iso (a -> b) (b -> a)
  	-- Defined at <interactive>:3:1

Expected behavior

:info -> should work just as :info <-> does.

Environment

  • GHC version used: 8.11.0.20200403
Edited by Icelandjack
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information