[Haskell-beginners] flip lookup in ghci

Magnus Therning magnus at therning.org
Fri Feb 20 08:06:22 EST 2009


On Fri, Feb 20, 2009 at 12:44 PM, Matt R <mattrussell324 at googlemail.com> wrote:
> Rafael Gustavo da Cunha Pereira Pinto <RafaelGCPP.Linux at gmail.com>:
>> you are applying the type to lookup only!
>>
>> try let lookupIn = ((flip lookup ) :: (Eq a) => [(a, b)] -> a -> Maybe b )
>
> Oops, I didn't mean to include my attempts at type annotation in my
> previous email...I meant to write
>
> ghci> let lookupIn = flip lookup
>
> But it doesn't seem to make any difference either way. I still get
>
> ghci> :t lookupIn
> lookupIn :: [((), b)] -> () -> Maybe b
>
> regardless :(

Indeed, how funky:

  GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
  Loading package base ... linking ... done.
  Prelude> :t flip lookup
  flip lookup :: (Eq a) => [(a, b)] -> a -> Maybe b
  Prelude> let lookupIn = flip lookup
  Prelude> :t lookupIn
  lookupIn :: [((), b)] -> () -> Maybe b
  Prelude>

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Beginners mailing list