Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-29 09:59:14 × avn quits (~avn@78-56-108-78.static.zebra.lt) (Remote host closed the connection)
2021-03-29 09:59:26 <ski> yea, i (briefly) looked at that
2021-03-29 09:59:40 <ski> and that doesn't sound like you want to use `Line' as a monad
2021-03-29 10:00:16 <ski> hmm
2021-03-29 10:00:26 <ski> i think i may have a counter example
2021-03-29 10:00:33 <gaff> yes, i don't care if it is not a monad, but how do you solve this problem, because there is a case where you have to return some dummy value.
2021-03-29 10:00:47 <gaff> ?
2021-03-29 10:01:40 × gitgood quits (~gitgood@80-44-12-39.dynamic.dsl.as9105.com) (Remote host closed the connection)
2021-03-29 10:03:11 <ski> (join . join) (Foo (Foo (Foo (a,b),Empty),Foo (Empty,Foo (g,h)))) = join (Foo (Foo (a,b),Foo (g,h))) = Foo (a,h)
2021-03-29 10:03:17 <ski> (join . fmap join) (Foo (Foo (Foo (a,b),Empty),Foo (Empty,Foo (g,h)))) = join (Foo (Empty,Empty)) = Empty
2021-03-29 10:03:54 <ski> this is assuming `join (Foo (Empty,_)) = Empty' and `join (Foo (_,Empty)) = Empty'
2021-03-29 10:03:57 <lortabac> gaff: how you solve this problem depends on what your program does and how you handle errors
2021-03-29 10:04:20 <ski> gaff : what opqdonut and lortabac said
2021-03-29 10:04:27 ddellacosta joins (~ddellacos@86.106.143.10)
2021-03-29 10:04:54 <lortabac> you can return some default value (if there is one that makes sense), you can return an 'Either Error Int', or a 'Maybe Int', you can throw an exception...
2021-03-29 10:04:58 × shailangsa quits (~shailangs@host86-161-220-11.range86-161.btcentralplus.com) ()
2021-03-29 10:05:16 <gaff> lortabac: yeah, or perhaps even call error
2021-03-29 10:05:33 <gaff> the easy way out.
2021-03-29 10:06:04 <ski> a generalization of "default value" is to use some "default value", not for the desired result of type `(Int,Int)', but for a larger expression that would include that result, if present
2021-03-29 10:06:46 peanut_ joins (~peanut_@2a02:8388:a101:2600:1aac:99fd:f87d:92f0)
2021-03-29 10:06:55 <ski> (in your case, possibly a default value of type `Int'. to use in place of the call to `p'. or perhaps a default value of type `IO ()' to use in place of the action that would otherwise make use of that result value from `p')
2021-03-29 10:07:19 <ski> gaff : point is, we can't tell you how you want to handle the alternative cases, here
2021-03-29 10:07:34 <gaff> ski: yeah, got it
2021-03-29 10:07:56 <ski> it really depends on your use-case, on what you're actually trying to to, trying to achieve
2021-03-29 10:08:15 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds)
2021-03-29 10:08:42 <gaff> in this one, my only need is for Foo (x, y) -> p (x, y). the other case no need, although it is needed elsewhere.
2021-03-29 10:09:36 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-29 10:09:37 × ddellacosta quits (~ddellacos@86.106.143.10) (Ping timeout: 268 seconds)
2021-03-29 10:09:40 <gaff> bash has a no-op operator :. is there some thing like that in haskell?
2021-03-29 10:10:22 <gaff> `: arg` does nothing in bash.
2021-03-29 10:10:22 × pupuupup quits (~pupuupup@ppp-124-122-192-176.revip2.asianet.co.th) (Ping timeout: 252 seconds)
2021-03-29 10:12:27 × azure2 quits (~azure@180.247.95.50) (Ping timeout: 246 seconds)
2021-03-29 10:12:29 <lortabac> gaff: yes, there is 'return ()'
2021-03-29 10:12:45 molehillish joins (~molehilli@2600:8800:8d06:1800:6438:fe04:a25d:577)
2021-03-29 10:13:01 <gaff> i see, but then that works only for monad instances, right.
2021-03-29 10:13:23 <lortabac> no sorry, I meant 'return () :: IO ()'
2021-03-29 10:13:31 <gaff> ah
2021-03-29 10:14:12 × enoq quits (~textual@194-208-146-143.lampert.tv) (Ping timeout: 246 seconds)
2021-03-29 10:14:26 <lortabac> but of course you cannot use it directly in 'p :: (Int, Int) -> Int'
2021-03-29 10:14:52 × heatsink quits (~heatsink@2600:1700:bef1:5e10:f0bc:f236:90c7:a6f5) (Remote host closed the connection)
2021-03-29 10:14:56 <gaff> i see
2021-03-29 10:14:59 <ski> what do you mean by "no-op operator" ?
2021-03-29 10:15:12 <ski> in some sense, `id' could be considered one
2021-03-29 10:15:34 <gaff> ski: thanks much
2021-03-29 10:15:40 <ski> > id 42
2021-03-29 10:15:42 <lambdabot> 42
2021-03-29 10:15:46 <gaff> lortabac: thanks much
2021-03-29 10:15:56 <gaff> opqdonut: thanks much for your time.
2021-03-29 10:16:31 <peanut_> > id (id (id 1))
2021-03-29 10:16:33 <lambdabot> 1
2021-03-29 10:17:04 × molehillish quits (~molehilli@2600:8800:8d06:1800:6438:fe04:a25d:577) (Ping timeout: 245 seconds)
2021-03-29 10:17:19 malumore joins (~malumore@151.62.126.223)
2021-03-29 10:17:34 × lawid quits (~quassel@dslb-178-005-075-139.178.005.pools.vodafone-ip.de) (Ping timeout: 260 seconds)
2021-03-29 10:17:34 enoq joins (~textual@194-208-146-143.lampert.tv)
2021-03-29 10:18:06 <gaff> switching topics here -- i encounterred a situation recently where a functiion, say f, defined in one module, when called from another module, say Main, works fine. but if i move the function to Main or some other module, it hangs. i don't have the code with me now, but any idea what's going on?
2021-03-29 10:18:08 lawid joins (~quassel@dslb-090-186-122-181.090.186.pools.vodafone-ip.de)
2021-03-29 10:18:56 <gaff> ski: no -op operator just doesn't do anything.
2021-03-29 10:19:22 <gaff> bash -- `: arg` doesn't do anything.
2021-03-29 10:19:35 <peanut_> : is just true
2021-03-29 10:19:40 <gaff> doesn't process or execute anything
2021-03-29 10:20:15 × Majiir quits (~Majiir@pool-96-237-149-35.bstnma.fios.verizon.net) (Quit: CUT THE HARDLINES!!)
2021-03-29 10:20:16 <xsperry> > id id id 1
2021-03-29 10:20:16 <gaff> peanut_: correct.
2021-03-29 10:20:19 <lambdabot> 1
2021-03-29 10:20:50 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-03-29 10:21:03 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-29 10:21:54 × __minoru__shirae quits (~shiraeesh@109.166.57.99) (Ping timeout: 246 seconds)
2021-03-29 10:22:48 <peanut_> > const 42 (putStrLn "nothing")
2021-03-29 10:22:51 <lambdabot> 42
2021-03-29 10:22:54 × dandart quits (~Thunderbi@home.dandart.co.uk) (Remote host closed the connection)
2021-03-29 10:23:10 <gaff> in bash, `: arg` expands `arg` but does nothing else.
2021-03-29 10:23:23 <peanut_> 🤔
2021-03-29 10:23:34 <gaff> like you can do : > some-file-path
2021-03-29 10:24:19 <gaff> peanut_: ok
2021-03-29 10:25:35 × MarcelineVQ quits (~anja@198.254.208.159) (Read error: Connection reset by peer)
2021-03-29 10:26:10 <gaff> so it is strange that which module a function lives affect performace?
2021-03-29 10:26:11 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-03-29 10:26:54 MarcelineVQ joins (~anja@198.254.208.159)
2021-03-29 10:27:11 <peanut_> only thing i can think of is f uses another function g, defined in both modules but g doesnt terminate in Main
2021-03-29 10:27:13 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-29 10:27:13 Majiir joins (~Majiir@pool-96-237-149-35.bstnma.fios.verizon.net)
2021-03-29 10:28:11 <gaff> peanut_: no soory, that's not case at all. f calls functions that terminate well.
2021-03-29 10:28:57 <gaff> and even more bizarre, call f from other modules with smaller inputs works just fine.
2021-03-29 10:29:13 <peanut_> I'd have to see it
2021-03-29 10:29:32 <gaff> yeah, i will come back here when i get the code.
2021-03-29 10:30:19 <gaff> btw, cabal 3.4 works pretty good so far with nix-style builds.
2021-03-29 10:30:47 <gaff> documentations needs catch up, though.
2021-03-29 10:32:05 <gaff> peanut_: thank you very much. i will come back later when i get access to the code.
2021-03-29 10:32:33 <peanut_> 👍
2021-03-29 10:33:44 × gaff quits (~user@49.207.222.255) (Quit: ERC (IRC client for Emacs 27.1))
2021-03-29 10:34:41 × lawid quits (~quassel@dslb-090-186-122-181.090.186.pools.vodafone-ip.de) (Ping timeout: 240 seconds)
2021-03-29 10:37:40 × idhugo_ quits (~idhugo@87-49-147-45-mobile.dk.customer.tdc.net) (Ping timeout: 246 seconds)
2021-03-29 10:37:59 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-03-29 10:38:27 lawid joins (~quassel@dslb-090-186-122-181.090.186.pools.vodafone-ip.de)
2021-03-29 10:38:34 pyuk joins (~vroom@217.138.252.168)
2021-03-29 10:38:37 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-29 10:38:58 × pyuk quits (~vroom@217.138.252.168) (Client Quit)
2021-03-29 10:39:03 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-03-29 10:39:38 × puke quits (~vroom@217.138.252.196) (Ping timeout: 240 seconds)
2021-03-29 10:41:50 bor0 joins (~boro@unaffiliated/boro/x-000000001)

All times are in UTC.