Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-07 02:10:18 × Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 246 seconds)
2021-03-07 02:10:20 <mniip> heck-to-the-gnom, the compiler has certain limitations
2021-03-07 02:11:25 <c_wraith> I think 63 elements is all that's required by the spec, but it also allows for instances to stop significantly lower
2021-03-07 02:11:25 × gentauro quits (~gentauro@unaffiliated/gentauro) (Read error: Connection reset by peer)
2021-03-07 02:12:17 gentauro joins (~gentauro@unaffiliated/gentauro)
2021-03-07 02:12:46 bigbosskor joins (~Android@182.232.52.52)
2021-03-07 02:13:11 kiweun joins (~kiweun@2607:fea8:2a62:9600:c5e6:2aef:3cd6:33c8)
2021-03-07 02:13:23 <heck-to-the-gnom> 62, in ghci, just figured that out. Does this mean that there's a certain limit to how many functions can be chained together? Or does that get canceled out somehow? (obv it'd place limits on function parameters, but... due to currying, I'm not 100% certain on that)
2021-03-07 02:13:31 × bigbosskor quits (~Android@182.232.52.52) (Read error: Connection reset by peer)
2021-03-07 02:14:03 <heck-to-the-gnom> Oh, GHC said that nesting tuples is allowed, nvm, currying fixes that
2021-03-07 02:14:06 <heck-to-the-gnom> brilliant
2021-03-07 02:14:13 <c_wraith> Nah, the limit is just on elements in a single tuple
2021-03-07 02:14:22 <c_wraith> And you can have more elements in your own data type.
2021-03-07 02:14:43 <c_wraith> There are good arguments to be made that once you're past about 4, you should be using a custom type anyway
2021-03-07 02:14:48 <heck-to-the-gnom> Hm, well, that's certainly interesting.
2021-03-07 02:14:56 <heck-to-the-gnom> Or at least an array for heavens sake
2021-03-07 02:18:02 × conal_ quits (~conal@192.145.118.143) (Quit: Computer has gone to sleep.)
2021-03-07 02:18:18 <heck-to-the-gnom> How would I use the @hoogle function from within ghci? e.g find functions of a certain type:
2021-03-07 02:18:24 <heck-to-the-gnom> @hoogle [a] -> a
2021-03-07 02:18:24 <lambdabot> Prelude head :: [a] -> a
2021-03-07 02:18:25 <lambdabot> Prelude last :: [a] -> a
2021-03-07 02:18:25 <lambdabot> Data.List head :: [a] -> a
2021-03-07 02:18:35 conal joins (~conal@192.145.118.143)
2021-03-07 02:18:43 <c_wraith> I don't think any of the projects that used to do that have been maintained.
2021-03-07 02:19:15 <c_wraith> You can set up a local hoogle and search it via command line, though. and I suppose you can get ghci to shell for a single command
2021-03-07 02:19:58 <heck-to-the-gnom> Regardless, it's still useful, I was looking for `last`, under the name `foot` given that `head` could also be called `first`
2021-03-07 02:20:21 <c_wraith> ghci also has :browse to show you the contents of modules. can be worth knowing about
2021-03-07 02:20:28 <heck-to-the-gnom> I'd like to know how to do that without pinging external sources, I may just end up getting local hoogle though, good point
2021-03-07 02:20:47 <heck-to-the-gnom> Yeah, I found that, but it's not quite what I'm looking for, still useful though
2021-03-07 02:20:56 <c_wraith> yeah, it's definitely a different thing.
2021-03-07 02:21:37 <heck-to-the-gnom> I mean, if I know it's in prelude, I could probably set up a shell script to grep for it in :browse 's output...
2021-03-07 02:21:53 <heck-to-the-gnom> think*
2021-03-07 02:22:20 stree joins (~stree@68.36.8.116)
2021-03-07 02:23:09 × conal quits (~conal@192.145.118.143) (Ping timeout: 260 seconds)
2021-03-07 02:23:39 × Jd007 quits (~Jd007@162.156.11.151) (Quit: Jd007)
2021-03-07 02:24:07 <olligobber> @hoogle Foldable t => t a -> a
2021-03-07 02:24:08 <lambdabot> Test.Extrapolate.TypeBinding argTy1of1 :: con a -> a
2021-03-07 02:24:08 <lambdabot> Prelude maximum :: forall a . (Foldable t, Ord a) => t a -> a
2021-03-07 02:24:09 <lambdabot> Prelude minimum :: forall a . (Foldable t, Ord a) => t a -> a
2021-03-07 02:24:16 <c_wraith> :t fold
2021-03-07 02:24:17 <lambdabot> (Foldable t, Monoid m) => t m -> m
2021-03-07 02:24:18 <olligobber> not what I wanted
2021-03-07 02:24:23 <c_wraith> is that the one you wanted?
2021-03-07 02:24:30 <olligobber> nah
2021-03-07 02:24:47 <c_wraith> so what were you looking for?
2021-03-07 02:24:54 <olligobber> head/last
2021-03-07 02:25:13 <olligobber> :t head . toList
2021-03-07 02:25:15 <lambdabot> error:
2021-03-07 02:25:15 <lambdabot> Ambiguous occurrence ‘toList’
2021-03-07 02:25:15 <lambdabot> It could refer to
2021-03-07 02:25:24 <olligobber> hmm
2021-03-07 02:25:55 <c_wraith> :t foldr const (error "the world lied to me")
2021-03-07 02:25:56 <lambdabot> Foldable t => t b -> b
2021-03-07 02:26:26 <c_wraith> or, I suppose...
2021-03-07 02:26:30 <c_wraith> :t foldr1 const
2021-03-07 02:26:31 <lambdabot> Foldable t => t b -> b
2021-03-07 02:26:49 <olligobber> :t getFirst . foldMap (First . Just)
2021-03-07 02:26:51 <lambdabot> Foldable t => t a -> Maybe a
2021-03-07 02:27:53 <olligobber> heck-to-the-gnom, I would just open a browser, type hoogle and press tab to search
2021-03-07 02:28:22 <c_wraith> I can understand wanting to be able to search without an internet connection
2021-03-07 02:28:39 bigbosskor joins (~Android@182.232.52.52)
2021-03-07 02:28:43 <heck-to-the-gnom> I have an xmonad binding to search hoogle `M-s h`
2021-03-07 02:29:18 <heck-to-the-gnom> Works with xmonad's prompt system, works for me, but then again, offline is really the goal here, as well as faster response times anyway
2021-03-07 02:29:37 × gitgoood quits (~gitgood@82-132-218-66.dab.02.net) (Read error: Connection reset by peer)
2021-03-07 02:29:45 bitmapper joins (uid464869@gateway/web/irccloud.com/x-qdyadkvccmgruvao)
2021-03-07 02:30:06 ADG1089_ joins (~adg1089@171.76.153.167)
2021-03-07 02:30:06 × bigbosskor quits (~Android@182.232.52.52) (Read error: Connection reset by peer)
2021-03-07 02:30:34 <heck-to-the-gnom> I haven't been able to deduce wtf `(.)` does exactly, and its documentation isn't exactly clear... What does it do? I've seen it in place of `$` a few times, but all the times I've tried to use it a wall of errors chases me down the hallway.
2021-03-07 02:31:28 <c_wraith> Both of them are uniquely specified by their types
2021-03-07 02:31:29 × ADG1089_ quits (~adg1089@171.76.153.167) (Read error: Connection reset by peer)
2021-03-07 02:31:35 <c_wraith> :t ($)
2021-03-07 02:31:36 <lambdabot> (a -> b) -> a -> b
2021-03-07 02:31:40 ADG1089_ joins (~adg1089@122.163.167.99)
2021-03-07 02:32:09 <c_wraith> first argument is a function. Second argument is a value of the function's argument type. Returns the result of applying the function to the value
2021-03-07 02:32:33 <c_wraith> > show $ 3
2021-03-07 02:32:35 <lambdabot> "3"
2021-03-07 02:32:58 <c_wraith> Might seem boring, but it's conveniently the lowest possible precedence operator, so you can do things like...
2021-03-07 02:33:03 <c_wraith> > show $ 1 + 2
2021-03-07 02:33:05 <lambdabot> "3"
2021-03-07 02:34:48 <c_wraith> (.) is slightly more complicated, but *really* useful.
2021-03-07 02:35:34 <olligobber> @src (.)
2021-03-07 02:35:34 <lambdabot> (f . g) x = f (g x)
2021-03-07 02:35:39 <olligobber> @src ($)
2021-03-07 02:35:39 <lambdabot> f $ x = f x
2021-03-07 02:35:41 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-07 02:35:54 <olligobber> so f . g $ x == f $ g $ x
2021-03-07 02:36:27 <olligobber> $ is useful for avoiding brackets
2021-03-07 02:37:34 b_ee joins (~b@static-87-75-97-107.vodafonexdsl.co.uk)
2021-03-07 02:37:55 <c_wraith> (.) is mostly about not bothering to name arguments.
2021-03-07 02:38:15 bigbosskor joins (~Android@182.232.52.52)
2021-03-07 02:38:17 × bigbosskor quits (~Android@182.232.52.52) (Read error: Connection reset by peer)
2021-03-07 02:38:34 <c_wraith> You can obviously go too far in trying to do that. But a lot of things form simple pipelines where naming an argument would just be extra noise
2021-03-07 02:38:39 × Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer)
2021-03-07 02:39:14 <monochrom> That's not how I use (.). I use it to express a pipeline. I usually still have an argument. (h . g . f) x
2021-03-07 02:40:02 <monochrom> And when I don't have a simple pipeline, I don't shoehorn things into (.)
2021-03-07 02:41:43 <monochrom> pointfree would be the one about not bothering to name arguments. But pointfree is way more overboard than just using (.)
2021-03-07 02:42:22 <c_wraith> Do you go out of your way to write things like (\x -> (First . just) x) instead of (First . Just)?
2021-03-07 02:42:26 <monochrom> If you have (f x, g x), pointfree has a combinator for that. If you have (f x, f y), pointfree has a combinator for that. Etc etc
2021-03-07 02:42:34 <monochrom> No.
2021-03-07 02:43:36 Lord_of_Life_ joins (~Lord@unaffiliated/lord-of-life/x-0885362)

All times are in UTC.