Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 400 401 402 403 404 405 406 407 408 409 410 .. 5022
502,152 events total
2020-10-04 02:33:41 nbloomf joins (~nbloomf@2600:1700:83e0:1f40:190b:21b1:e82d:dbc9)
2020-10-04 02:34:48 snakemasterflex joins (~snakemast@213.100.206.23)
2020-10-04 02:39:49 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 264 seconds)
2020-10-04 02:40:27 × Amras quits (~Amras@unaffiliated/amras0000) (Ping timeout: 272 seconds)
2020-10-04 02:42:12 ksixty joins (~Adium@109-252-45-112.nat.spd-mgts.ru)
2020-10-04 02:45:45 × theDon quits (~td@94.134.91.90) (Ping timeout: 240 seconds)
2020-10-04 02:47:55 theDon joins (~td@94.134.91.94)
2020-10-04 02:49:05 <lechner> Hi, I recently discovered Haskell and love it. At the same time, I wonder if it can express all of a programmer's common intentions. Functional programming seems strictly inferential, and H. Curry read Whitehead and Russell. Do I have to worry about Haskell being incomplete similar to algebra?
2020-10-04 02:50:57 × reallymemorable quits (~quassel@ip68-9-215-56.ri.ri.cox.net) (Remote host closed the connection)
2020-10-04 02:52:16 <sm[m]> lechner: someone more knowledgeable on this will come along, but you don't have to worry about being able to express practical software
2020-10-04 02:53:36 lagothrix is now known as Guest27951
2020-10-04 02:53:36 × Guest27951 quits (~lagothrix@unaffiliated/lagothrix) (Killed (hitchcock.freenode.net (Nickname regained by services)))
2020-10-04 02:53:42 lagothrix joins (~lagothrix@unaffiliated/lagothrix)
2020-10-04 02:53:52 <sm[m]> what sort of situation could arise if your fear is true ?
2020-10-04 02:59:20 × nineonine quits (~nineonine@216.81.48.202) (Remote host closed the connection)
2020-10-04 03:00:01 × shortdudey1231 quits (~shortdude@178.162.204.214) ()
2020-10-04 03:01:02 GyroW_ joins (~GyroW@d54C03E98.access.telenet.be)
2020-10-04 03:01:03 × GyroW_ quits (~GyroW@d54C03E98.access.telenet.be) (Changing host)
2020-10-04 03:01:03 GyroW_ joins (~GyroW@unaffiliated/gyrow)
2020-10-04 03:01:32 × elliott__ quits (~elliott@pool-108-45-154-71.washdc.fios.verizon.net) (Ping timeout: 260 seconds)
2020-10-04 03:01:55 × GyroW quits (~GyroW@unaffiliated/gyrow) (Ping timeout: 240 seconds)
2020-10-04 03:02:48 <dsal> lechner: I write almost all of my software in Haskell.
2020-10-04 03:06:07 <dsal> heh, my cachix CI task takes about 2 hours to run for my mqttd. About 3m for my old stack thing now that I've fixed it.
2020-10-04 03:06:10 <davean> lechner: its turing complete, it can do exactly what any other programming system can do.
2020-10-04 03:08:44 ksixty1 joins (~Adium@static.100.218.46.78.clients.your-server.de)
2020-10-04 03:10:52 × ksixty quits (~Adium@109-252-45-112.nat.spd-mgts.ru) (Ping timeout: 260 seconds)
2020-10-04 03:11:38 nineonine joins (~nineonine@216-19-190-182.dyn.novuscom.net)
2020-10-04 03:12:01 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-10-04 03:14:28 hackage silkscreen 0.0.0.0 - Prettyprinting transformers. https://hackage.haskell.org/package/silkscreen-0.0.0.0 (robrix)
2020-10-04 03:16:00 × GyroW_ quits (~GyroW@unaffiliated/gyrow) (Ping timeout: 260 seconds)
2020-10-04 03:16:06 GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be)
2020-10-04 03:16:06 × GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host)
2020-10-04 03:16:06 GyroW joins (~GyroW@unaffiliated/gyrow)
2020-10-04 03:16:40 × nineonine quits (~nineonine@216-19-190-182.dyn.novuscom.net) (Ping timeout: 272 seconds)
2020-10-04 03:16:45 × bloodstalker quits (~bloodstal@46.166.187.188) (Read error: Connection reset by peer)
2020-10-04 03:17:26 zoom joins (44beb1c9@068-190-177-201.res.spectrum.com)
2020-10-04 03:17:31 conal joins (~conal@64.71.133.70)
2020-10-04 03:17:48 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-10-04 03:19:03 <zoom> I have a basic polymorphic type question. I have default (Int, Float) set for my module. In compiled code, I have "z = 0". GHCI reports z's type as Int, as expected.
2020-10-04 03:19:15 × irc_user quits (uid423822@gateway/web/irccloud.com/x-qmbsqpmesujkhtzf) (Quit: Connection closed for inactivity)
2020-10-04 03:19:20 <zoom> If I then pass z to the following function:
2020-10-04 03:19:33 <zoom> retInteger :: Integer -> Integer ; retInteger x = x
2020-10-04 03:19:46 <zoom> and store it in z2, the type of z is now Integer instead of Int
2020-10-04 03:19:51 <zoom> to recap:
2020-10-04 03:20:02 × sis7 quits (~user@2001:15e8:110:473e::1) (Ping timeout: 260 seconds)
2020-10-04 03:20:05 <zoom> z = 0 (type is Int)
2020-10-04 03:20:14 <zoom> z2 = retInteger z
2020-10-04 03:20:26 <zoom> z now compiles as Integer
2020-10-04 03:20:30 conal joins (~conal@64.71.133.70)
2020-10-04 03:20:30 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-10-04 03:21:36 <zoom> why is the type of z affected by the fact that it was passed to retInteger, which returned a separate immutable value
2020-10-04 03:22:05 <dsal> I think you're inferring too hard. If z should be an Int and fail here, you should say `z :: Int`
2020-10-04 03:22:24 <zoom> understood I can explicitly cast. Just trying to understand the compiler / language behavior
2020-10-04 03:22:38 <dolio> :: isn't casting.
2020-10-04 03:22:41 <dsal> I don't think cast is the right word.
2020-10-04 03:22:43 <zoom> didn't mean to say casting
2020-10-04 03:23:02 <zoom> I mean I understand I can explicitly specify the type
2020-10-04 03:23:43 <zoom> but trying to understand why the compiler implicitly switches z from an Int to Integer if z is passed to a function that treats z as an Integer
2020-10-04 03:23:59 <zoom> i would expect z2 would be an Integer and z would remain an Int
2020-10-04 03:24:00 <dsal> It's not totally clear what you're doing.
2020-10-04 03:24:01 elliott__ joins (~elliott@pool-108-45-154-71.washdc.fios.verizon.net)
2020-10-04 03:24:15 <zoom> default (Int, Float)
2020-10-04 03:24:16 <zoom> z = 0
2020-10-04 03:24:22 <zoom> when compiled, the type of z is an Int, as expected
2020-10-04 03:24:33 <dolio> z needs to have type `Integer` to be an argument of `retInteger`.
2020-10-04 03:24:42 <dolio> So defaulting isn't even happening.
2020-10-04 03:25:02 <cohn> zoom: maybe this helps? https://stackoverflow.com/questions/3429291/what-is-the-difference-between-int-and-integer
2020-10-04 03:25:05 <dsal> Are you playing in ghci?
2020-10-04 03:25:13 <zoom> not ghci, this is compiled code
2020-10-04 03:25:24 <dolio> Defaulting only happens when something needs a monomorphic type, but nothing else in the code determines the choice.
2020-10-04 03:25:55 × CMCDragonkai1 quits (~Thunderbi@120.17.204.172) (Ping timeout: 240 seconds)
2020-10-04 03:26:10 <dsal> You mentioned ghci. You're being vague about what you're doing, because you can't both have something you're asking GHCI for the default type of, and have a thing you're compiling that passes a value to a function with a known type.
2020-10-04 03:26:28 <zoom> i only use ghci to check the type the compiler inferred. code is compiled
2020-10-04 03:26:29 sis7 joins (~user@80.211.200.62)
2020-10-04 03:26:55 × borne quits (~fritjof@200116b864ada80007933c164a08810c.dip.versatel-1u1.de) (Ping timeout: 240 seconds)
2020-10-04 03:27:21 <dsal> But if you're passing z to a function that requires an Integer, then you know the type that was inferred is Integer.
2020-10-04 03:28:30 <zoom> ok, i guess the compiler infers z1 is an Integer from the call. what threw me off is if I compile z = 0 by itself it's an Int. If I then add the line to call retInteger it's an Integer. I considered them two separate statements but I guess the compiler changes the inferences of z1 = 0 when it sees the call to retInteger
2020-10-04 03:29:00 <zoom> If I explicitly set z :: Int and then call retInteger I get the type mismatch error, as expected
2020-10-04 03:29:49 <dsal> In general, you don't want to do that. -Wall will enable a warning telling you a) what it inferred the type to be and b) that it shouldn't have to do that because you should declare your toplevel types.
2020-10-04 03:30:47 × ksixty1 quits (~Adium@static.100.218.46.78.clients.your-server.de) (Quit: Leaving.)
2020-10-04 03:32:32 <zoom> ok, tried the -Wall and see the warning you mentioned.
2020-10-04 03:34:43 thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de)
2020-10-04 03:34:59 <zoom> does top-level binding refer to scope?
2020-10-04 03:35:08 <zoom> ie, the outermost scope?
2020-10-04 03:35:22 conal joins (~conal@64.71.133.70)
2020-10-04 03:35:45 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-10-04 03:35:58 × ym555 quits (~ym@41.42.203.37) (Ping timeout: 265 seconds)
2020-10-04 03:36:36 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-10-04 03:39:07 <dsal> Yeah. I don't annotate all my types, just at the toplevel and whenever it's otherwise helpful or avoids confusion.
2020-10-04 03:39:07 × thir quits (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) (Ping timeout: 240 seconds)
2020-10-04 03:40:50 <zoom> thanks. i'm surprised it's suggested practice considering how useful type inference is. is the suggestion limited to top-level binding because it's assumed all subsequent calls/uses flow from the types at the top-level?
2020-10-04 03:41:19 <dsal> It's a good boundary. You can get *massively* confused if you let the type system guess your whole program.
2020-10-04 03:41:25 ym555 joins (~ym@41.42.203.37)
2020-10-04 03:41:58 <zoom> my preference coming from C is to specify all my types. I thought I was actually adapting by using inference instead.
2020-10-04 03:42:13 <dsal> You think you're working with a list of ints or something, but no, it's a Foldable Semigroup of an Integral value.
2020-10-04 03:42:20 <zoom> ie, adapting to the haskell way. thanks for setting me straight
2020-10-04 03:43:22 <hololeap> using type annotations here and there (e.g. all top level definitions) helps to make sure that your thought process and the compiler are in-sync
2020-10-04 03:43:24 <dsal> -Wall is generally a good idea. :)
2020-10-04 03:44:01 <zoom> makes perfect sense to me. and would my preference now that I see it's recommended practice anyway
2020-10-04 03:44:03 <dsal> It makes your code far easier for you as a human to read, but it also means your error messages won't be just an arbitrary permutation of type classes and a frowny face.

All times are in UTC.