Newest at the top
2024-10-08 22:14:17 +0200 | <lambdabot> | (b -> c) -> (a -> b) -> a -> c |
2024-10-08 22:14:16 +0200 | <tomsmeding> | :t (.) |
2024-10-08 22:14:11 +0200 | <tomsmeding> | in the third version, I'm using (.) to _compose_ three functions, then applying the whole composition at once to the argument (Just 42) |
2024-10-08 22:13:41 +0200 | <tomsmeding> | in the second version, I'm using ($) to save parentheses; this style is sometimes used, but is typically reserved if the function to apply is short and the argument is a long, typically multi-line expression |
2024-10-08 22:13:38 +0200 | <sam113101> | yeah |
2024-10-08 22:13:09 +0200 | <tomsmeding> | the first version you should be able to read: that's just applying functions as usual |
2024-10-08 22:12:57 +0200 | <lambdabot> | "24 TSUJ" |
2024-10-08 22:12:56 +0200 | <tomsmeding> | > map toUpper . reverse . show $ Just 42 |
2024-10-08 22:12:50 +0200 | <lambdabot> | "24 TSUJ" |
2024-10-08 22:12:49 +0200 | <tomsmeding> | > map toUpper $ reverse $ show $ Just 42 |
2024-10-08 22:12:42 +0200 | <lambdabot> | "24 TSUJ" |
2024-10-08 22:12:40 +0200 | <tomsmeding> | > map toUpper (reverse (show (Just 42))) |
2024-10-08 22:12:22 +0200 | <tomsmeding> | there are various ways to do that: |
2024-10-08 22:12:16 +0200 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-10-08 22:12:04 +0200 | <tomsmeding> | (&) is seldomly used in haskell; the conventional code style is to put the function to apply on the _left_ side of the thing you're applying it to, not on the right |
2024-10-08 22:11:50 +0200 | Angelz | (Angelz@2605:6400:30:fc15:9bd1:2217:41cd:bb15) |
2024-10-08 22:11:39 +0200 | <lambdabot> | "HELLO" |
2024-10-08 22:11:38 +0200 | <tomsmeding> | > map toUpper $ "hello" |
2024-10-08 22:11:33 +0200 | <tomsmeding> | normal function application :) |
2024-10-08 22:11:24 +0200 | <sam113101> | what's $ |
2024-10-08 22:11:10 +0200 | <sam113101> | I think yes |
2024-10-08 22:10:50 +0200 | <tomsmeding> | sam113101: is that what you're looking for? (&) is in Data.Function |
2024-10-08 22:10:40 +0200 | <lambdabot> | "HELLO" |
2024-10-08 22:10:39 +0200 | <tomsmeding> | > "hello" & map toUpper |
2024-10-08 22:10:36 +0200 | <lambdabot> | error: Variable not in scope: hello :: [Char] |
2024-10-08 22:10:34 +0200 | <tomsmeding> | > hello & map toUpper |
2024-10-08 22:10:28 +0200 | <lambdabot> | "HELLO" |
2024-10-08 22:10:27 +0200 | <tomsmeding> | > map toUpper "hello" |
2024-10-08 22:10:10 +0200 | <lambdabot> | (a -> b) -> a -> b |
2024-10-08 22:10:10 +0200 | <tomsmeding> | :t ($) |
2024-10-08 22:10:05 +0200 | <lambdabot> | a -> (a -> b) -> b |
2024-10-08 22:10:04 +0200 | <tomsmeding> | :t (&) |
2024-10-08 22:09:30 +0200 | <sam113101> | does haskell have something like the pipe operator (|>) in elixir? |
2024-10-08 22:08:49 +0200 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-10-08 22:05:44 +0200 | sourcetarius | (~sourcetar@user/sourcetarius) (Quit: sourcetarius) |
2024-10-08 22:05:13 +0200 | alexherbo2 | (~alexherbo@2a02-8440-3215-f56e-1190-0b59-796f-612e.rev.sfr.net) alexherbo2 |
2024-10-08 22:04:05 +0200 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-10-08 22:00:24 +0200 | sord937 | (~sord937@gateway/tor-sasl/sord937) (Quit: sord937) |
2024-10-08 21:59:27 +0200 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) TimWolla |
2024-10-08 21:58:46 +0200 | codaraxis | (~codaraxis@user/codaraxis) Codaraxis |
2024-10-08 21:57:12 +0200 | vanishingideal | (~vanishing@user/vanishingideal) vanishingideal |
2024-10-08 21:55:29 +0200 | vanishingideal | (~vanishing@user/vanishingideal) (Ping timeout: 248 seconds) |
2024-10-08 21:53:27 +0200 | zfnmxt | (~zfnmxt@user/zfnmxt) zfnmxt |
2024-10-08 21:53:21 +0200 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 248 seconds) |
2024-10-08 21:49:03 +0200 | supercode | (~supercode@user/supercode) (Quit: Client closed) |
2024-10-08 21:48:19 +0200 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-10-08 21:48:00 +0200 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) (Quit: Bye) |
2024-10-08 21:41:22 +0200 | causal | (~eric@50.35.88.207) causal |
2024-10-08 21:40:58 +0200 | causal | (~eric@50.35.88.207) (Ping timeout: 252 seconds) |
2024-10-08 21:40:12 +0200 | vanishingideal | (~vanishing@user/vanishingideal) vanishingideal |