Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell reverse function application operator not working

Tags:

haskell

I'm playing around with Haskell, but I can't figure out why the reverse function application operator (&) is not working.

For example in ghci I get:

Prelude> "hello" & length

<interactive>:1:9: error:
    Variable not in scope: (&) :: [Char] -> ([a0] -> Int) -> t

When I expect it to return 5

Why is it not working?

like image 249
a544jh Avatar asked Oct 31 '25 07:10

a544jh


1 Answers

Looks like it's not in scope. Asking Hoogle tells me that you need to import it from, for example, Data.Function:

Prelude> import Data.Function
Prelude Data.Function> "hello" & length
5
like image 129
Koterpillar Avatar answered Nov 03 '25 11:11

Koterpillar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!