说我有以下功能:
infixr 0 <|
{-# INLINE (<|) #-}
(<|) :: (a -> b) -> a -> b
f <| x = f x
foo :: a -> (forall b. b -> b) -> a
foo x f = f x
以下内容未进行类型检查:
ghci> foo 3 <| id
Couldn't match expected type `forall b. b -> b'
with actual type `a0 -> a0'
In the second argument of `(<|)', namely `id'
In the expression: f 3 <| id
In an equation for `it': it = f 3 <| id
但是,foo 3 $ id
会。
(据我所知)(&lt; |)的定义与($)的定义相同。我几乎从基础库源中删除了定义,并将($)的每个实例都更改为(&lt; |)。编译魔术?