Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,802,977 events total
2021-07-18 21:42:46 <geekosaur> lechner, no, it is a 4-element list
2021-07-18 21:42:56 <dsal> :t map
2021-07-18 21:42:57 <lambdabot> (a -> b) -> [a] -> [b]
2021-07-18 21:43:06 <geekosaur> thisis not lisp, a list is not a group of applications
2021-07-18 21:43:23 <dsal> map takes a function and applies it to each element inside a list. One list in, one list out.
2021-07-18 21:44:39 <lechner> that's what i am looking for, except one member (of all partially or unapplied functions) is specified as a . b
2021-07-18 21:45:19 <dsal> You're doing several things at once. You will likely have more success if you break them down a bit.
2021-07-18 21:45:53 <lechner> dsal: let's go with your approach. i am reading up on puns
2021-07-18 21:45:53 × azeem quits (~azeem@dynamic-adsl-94-34-39-251.clienti.tiscali.it) (Read error: Connection reset by peer)
2021-07-18 21:45:54 <dsal> A list is one thing, but it's not what your printf wants. So to work backwards, you'll have to figure out how to make what your printf wants.
2021-07-18 21:46:03 <lechner> yes
2021-07-18 21:46:14 <lechner> let's chuck printf
2021-07-18 21:46:16 × burnsidesLlama quits (~burnsides@dhcp168-011.wadham.ox.ac.uk) (Remote host closed the connection)
2021-07-18 21:46:17 <dsal> My approach is to make a function that formats your connection string.
2021-07-18 21:46:29 azeem joins (~azeem@dynamic-adsl-94-34-39-251.clienti.tiscali.it)
2021-07-18 21:46:43 burnsidesLlama joins (~burnsides@dhcp168-011.wadham.ox.ac.uk)
2021-07-18 21:47:12 <dsal> In MonadLogger, you can call that ToLogStr, but that's the opposite direction from "do less stuff" :)
2021-07-18 21:48:42 × wallymathieu quits (~wallymath@81-234-151-21-no94.tbcn.telia.com) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-07-18 21:51:29 × burnsidesLlama quits (~burnsides@dhcp168-011.wadham.ox.ac.uk) (Ping timeout: 265 seconds)
2021-07-18 21:52:42 × __monty__ quits (~toonn@user/toonn) (Quit: leaving)
2021-07-18 21:53:07 __monty__ joins (~toonn@user/toonn)
2021-07-18 21:53:19 × __monty__ quits (~toonn@user/toonn) (Client Quit)
2021-07-18 21:54:50 <lechner> can i define an instance of 'show' to return the string host ++ ":" ++ listen_port for a type that has both?
2021-07-18 21:55:05 <geekosaur> you can but you shouldn't
2021-07-18 21:55:20 <lechner> why not, please?
2021-07-18 21:55:47 <geekosaur> an instance of Show should match an instance of Read and ideally be a fragment of Haskell source that will reproduce a value of the type within ghc / ghci
2021-07-18 21:56:37 <geekosaur> otherwise you run into issues Show-ing or Read-ing structures that contain values of that type
2021-07-18 21:56:39 <lechner> could i add both?
2021-07-18 21:56:50 × fendor__ quits (~fendor@178.165.167.65.wireless.dyn.drei.com) (Remote host closed the connection)
2021-07-18 21:57:38 <geekosaur> what do you mean?
2021-07-18 21:58:00 <lechner> Show and Read
2021-07-18 21:58:35 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-07-18 21:58:41 <dsal> lechner: That's not what show is for. This is why MonadLogger defines ToLogStr. You can make your own.
2021-07-18 21:59:47 <dminuoso> geekosaur: Strictly speaking, that is only requires for deriving generated instances. This notion that they "should" seems to be based in rumour or just an observation of established practice.
2021-07-18 21:59:47 <dsal> You *can* define your own Show and Read if you're pretty sure you can encapsulate all of the structure you want. It's not definitely the wrong idea all the time, but it's not easier than making something specific for logging and having your logger log with it.
2021-07-18 22:00:39 <dsal> I think it's the date/time stuff that has fancy Show instances that just make life miserable when you have them in data structures.
2021-07-18 22:01:08 <lechner> i should not use UTCTime in JSON decls?
2021-07-18 22:01:13 <pavonia> Custom Show instances are a PITA if you have to debug things. Just don't do it
2021-07-18 22:01:22 <lechner> okay
2021-07-18 22:01:42 <monochrom> Established practice is still something to respect. Of course, "respect" allows exceptions. OK I'm on a fence, I'll stop now.
2021-07-18 22:02:04 <lechner> i'm just learning
2021-07-18 22:02:13 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-07-18 22:02:33 jmorris joins (uid433911@id-433911.stonehaven.irccloud.com)
2021-07-18 22:02:35 × fendor quits (~fendor@178.165.167.65.wireless.dyn.drei.com) (Remote host closed the connection)
2021-07-18 22:03:08 × Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.)
2021-07-18 22:03:26 × jumper149 quits (~jumper149@80.240.31.34) (Quit: WeeChat 3.2)
2021-07-18 22:04:01 <sm> for learning, do whatever you like :)
2021-07-18 22:04:34 × yauhsien_ quits (~yauhsien@61-231-35-149.dynamic-ip.hinet.net) (Remote host closed the connection)
2021-07-18 22:04:58 <exarkun> Where's the Haskell implementation of https://en.wikipedia.org/wiki/Turtle_graphics ?
2021-07-18 22:05:04 geekosaur joins (~geekosaur@xmonad/geekosaur)
2021-07-18 22:05:22 × nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 268 seconds)
2021-07-18 22:05:52 <lechner> what's the precedence between $ and ++ please?
2021-07-18 22:06:55 <dminuoso> %i ($)
2021-07-18 22:07:05 <dminuoso> % :i ($)
2021-07-18 22:07:05 <yahb> dminuoso: ($) :: (a -> b) -> a -> b -- Defined in `GHC.Base'; infixr 0 $
2021-07-18 22:07:07 <dminuoso> % :i (++)
2021-07-18 22:07:08 <yahb> dminuoso: (++) :: [a] -> [a] -> [a] -- Defined in `GHC.Base'; infixr 5 ++
2021-07-18 22:07:18 <dminuoso> lechner: ^- See the fixity declarations?
2021-07-18 22:08:05 <dminuoso> The number is the precedence level
2021-07-18 22:08:09 <dsal> % :i (<>)
2021-07-18 22:08:09 <yahb> dsal: type GHC.Base.Semigroup :: * -> Constraint; class GHC.Base.Semigroup a where; (<>) :: a -> a -> a; ...; -- Defined in `GHC.Base'; infixr 6 <>
2021-07-18 22:08:17 <dsal> That's interesting.
2021-07-18 22:08:20 <dminuoso> And the `r` in infixr means its right-associative. We also have infixl for left associative
2021-07-18 22:08:28 × waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 246 seconds)
2021-07-18 22:09:02 × gehmehgeh quits (~user@user/gehmehgeh) (Quit: Leaving)
2021-07-18 22:09:23 <dminuoso> If no fixity is declared, an operator defaults to infixl 9.
2021-07-18 22:09:33 <lechner> dsal: ++ binds more tightly than $ right?
2021-07-18 22:09:41 <dminuoso> Yes.
2021-07-18 22:10:01 <monochrom> What do "0" and "5" tell you?
2021-07-18 22:10:18 × _xor quits (~xor@74.215.232.67) (Ping timeout: 268 seconds)
2021-07-18 22:10:32 <lechner> a relative ordering
2021-07-18 22:10:35 <dsal> I don't ever use ++. I just never considered ++ was lower than <>
2021-07-18 22:10:44 waleee joins (~waleee@h-98-128-228-119.NA.cust.bahnhof.se)
2021-07-18 22:11:06 <lechner> what is <> please? i have only seen that in purescript
2021-07-18 22:11:14 <dsal> :t (<>)
2021-07-18 22:11:16 <lambdabot> Semigroup a => a -> a -> a
2021-07-18 22:11:17 <dsal> :t (++)
2021-07-18 22:11:19 <lambdabot> [a] -> [a] -> [a]
2021-07-18 22:11:35 <dsal> ++ only works for lists. <> is like ++ but works for many other types.
2021-07-18 22:11:39 <xsperry> lechner, you can think of it as a more general ++. it works with more than just lists
2021-07-18 22:12:02 <lechner> dsal: should is stick to concat instead of ++?
2021-07-18 22:12:29 <dsal> :t concat
2021-07-18 22:12:30 <lambdabot> Foldable t => t [a] -> [a]
2021-07-18 22:12:31 Erutuon joins (~Erutuon@user/erutuon)
2021-07-18 22:12:37 <dsal> :t fold
2021-07-18 22:12:39 <lambdabot> (Foldable t, Monoid m) => t m -> m
2021-07-18 22:12:51 <dsal> That doesn't do the same thing, but depending on what you're doing, it might be better.
2021-07-18 22:13:18 <dsal> I use <> often, I just don't use ++. You can use ++ if you like. I was just commenting on the precedence.
2021-07-18 22:14:41 <dsal> I've got logging functions like `logErrorL, logInfoL, logDbgL :: (Foldable f, MonadLogger m) => f T.Text-> m ()` which are helpful when I want to log a list of Texts. e.g., `logInfoL = logInfoN . fold`
2021-07-18 22:19:55 hexfive joins (~eric@50.35.83.177)
2021-07-18 22:19:55 × zangi quits (~zangi@103.154.230.230) (Read error: Connection reset by peer)
2021-07-18 22:21:23 × Guest31 quits (~Guest31@76-236-222-208.lightspeed.tukrga.sbcglobal.net) (Quit: Client closed)
2021-07-18 22:27:12 <lechner> are those two lines acceptable for a newbie? https://dpaste.org/sqiW#L96,97
2021-07-18 22:27:33 × ph88^ quits (~ph88@2a02:8109:9e00:7e5c:f938:d06a:9ad7:b39c) (Read error: Connection reset by peer)
2021-07-18 22:27:56 ph88^ joins (~ph88@ip5f5af6fd.dynamic.kabel-deutschland.de)
2021-07-18 22:28:48 <dminuoso> Looks fine.
2021-07-18 22:29:12 <lechner> thanks to everyone for your help!
2021-07-18 22:29:22 <dminuoso> The `nice 19` looks dubious though.
2021-07-18 22:29:48 <lechner> what should it look like?
2021-07-18 22:30:48 nate1 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net)

All times are in UTC.