Logs: freenode/#haskell
| 2021-05-15 16:17:37 | → | idhugo joins (~idhugo@80-62-116-231-mobile.dk.customer.tdc.net) |
| 2021-05-15 16:18:57 | × | frozenErebus quits (~frozenEre@37.231.244.249) (Ping timeout: 260 seconds) |
| 2021-05-15 16:19:20 | → | ddellacosta joins (~ddellacos@86.106.143.33) |
| 2021-05-15 16:19:23 | → | guest5 joins (5619784f@cpc143846-cosh20-2-0-cust78.6-1.cable.virginm.net) |
| 2021-05-15 16:19:57 | × | rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds) |
| 2021-05-15 16:21:09 | × | cdsmith quits (~cdsmithus@c-73-184-127-183.hsd1.ga.comcast.net) (Ping timeout: 252 seconds) |
| 2021-05-15 16:23:02 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-05-15 16:23:55 | × | ddellacosta quits (~ddellacos@86.106.143.33) (Ping timeout: 252 seconds) |
| 2021-05-15 16:28:49 | × | guest5 quits (5619784f@cpc143846-cosh20-2-0-cust78.6-1.cable.virginm.net) (Quit: Connection closed) |
| 2021-05-15 16:31:07 | × | geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 268 seconds) |
| 2021-05-15 16:32:12 | → | bitmagie joins (~Thunderbi@200116b806a58c001928c930445b9f7e.dip.versatel-1u1.de) |
| 2021-05-15 16:32:58 | × | bitmagie quits (~Thunderbi@200116b806a58c001928c930445b9f7e.dip.versatel-1u1.de) (Client Quit) |
| 2021-05-15 16:33:21 | × | aidecoe quits (~aidecoe@unaffiliated/aidecoe) (Ping timeout: 265 seconds) |
| 2021-05-15 16:33:30 | → | sphi joins (~sphi@unaffiliated/sphi) |
| 2021-05-15 16:33:30 | → | rayyyy joins (~nanoz@gateway/tor-sasl/nanoz) |
| 2021-05-15 16:34:01 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:8dd2:2363:77ad:18a2) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-15 16:35:01 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:8dd2:2363:77ad:18a2) |
| 2021-05-15 16:35:57 | → | Alleria joins (~textual@zrcout.mskcc.org) |
| 2021-05-15 16:36:22 | Alleria | is now known as Guest78295 |
| 2021-05-15 16:38:10 | → | cdsmith joins (~cdsmithus@c-73-184-127-183.hsd1.ga.comcast.net) |
| 2021-05-15 16:39:24 | → | guest5 joins (5619784f@cpc143846-cosh20-2-0-cust78.6-1.cable.virginm.net) |
| 2021-05-15 16:40:50 | <xenon-> | guest5 you can use specifier in printf's s flag |
| 2021-05-15 16:41:00 | <xenon-> | to set string width |
| 2021-05-15 16:41:13 | <xenon-> | > printf "%10" "hello" |
| 2021-05-15 16:41:14 | <lambdabot> | error: |
| 2021-05-15 16:41:14 | <lambdabot> | • Ambiguous type variable ‘a0’ arising from a use of ‘show_M326445640457... |
| 2021-05-15 16:41:15 | <lambdabot> | prevents the constraint ‘(Show a0)’ from being solved. |
| 2021-05-15 16:41:19 | <xenon-> | > printf "%10" "hello" :: String |
| 2021-05-15 16:41:21 | <lambdabot> | "*Exception: printf: formatting string ended prematurely |
| 2021-05-15 16:41:26 | <xenon-> | > printf "%10s" "hello" :: String |
| 2021-05-15 16:41:27 | <lambdabot> | " hello" |
| 2021-05-15 16:41:39 | <xenon-> | > printf "%-10s" "hello" :: String |
| 2021-05-15 16:41:41 | <lambdabot> | "hello " |
| 2021-05-15 16:43:09 | → | Aquazi joins (uid312403@gateway/web/irccloud.com/x-mdtoudpfcoqbbopu) |
| 2021-05-15 16:43:27 | <guest5> | so like - https://paste.tomsmeding.com/7pKCCUZN ? |
| 2021-05-15 16:43:59 | <xenon-> | try it if you get desired formatting |
| 2021-05-15 16:44:13 | <xenon-> | > printf "%-10s%-10s" "hello" "world" :: String |
| 2021-05-15 16:44:15 | <lambdabot> | "hello world " |
| 2021-05-15 16:44:34 | <xenon-> | width can also be taken as an argument |
| 2021-05-15 16:44:41 | × | Rudd0 quits (~Rudd0@185.189.115.103) (Ping timeout: 246 seconds) |
| 2021-05-15 16:45:16 | <xenon-> | > printf "%-*s%-*s" 20 "hello" 20 "world" :: String |
| 2021-05-15 16:45:18 | <lambdabot> | "hello world " |
| 2021-05-15 16:45:30 | <guest5> | got a fat error |
| 2021-05-15 16:45:43 | <guest5> | https://paste.tomsmeding.com/6x0Tqwyv |
| 2021-05-15 16:45:50 | × | kenran quits (~kenran@i577BCDEC.versanet.de) (Quit: leaving) |
| 2021-05-15 16:45:58 | → | geowiesnot joins (~user@87-89-181-157.abo.bbox.fr) |
| 2021-05-15 16:46:11 | <xenon-> | you are passing 4 arguments to printf instead of 1 |
| 2021-05-15 16:46:36 | <int-e> | but the error is about (fromIntegral x / 1000 :: Double) needing a type signature to tell the compiler what the type is |
| 2021-05-15 16:47:03 | → | hypercube joins (~hypercube@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com) |
| 2021-05-15 16:47:15 | <int-e> | then you'll run into showFFloat (Just 3) (fromIntegral x / 1000) needing parenthesis, as xenon- pointed out |
| 2021-05-15 16:47:17 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:8dd2:2363:77ad:18a2) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-15 16:47:23 | → | Rudd0 joins (~Rudd0@185.189.115.108) |
| 2021-05-15 16:48:00 | <int-e> | > printf "%-10.3f" 0.3 :: String |
| 2021-05-15 16:48:02 | <lambdabot> | "0.300 " |
| 2021-05-15 16:49:15 | <int-e> | > printf "%10.3fm" 0.3 :: String |
| 2021-05-15 16:49:17 | <lambdabot> | " 0.300m" |
| 2021-05-15 16:49:19 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2021-05-15 16:50:10 | → | aidecoe joins (~aidecoe@unaffiliated/aidecoe) |
| 2021-05-15 16:50:23 | × | Lycurgus quits (~niemand@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt) |
| 2021-05-15 16:51:05 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-15 16:51:48 | <guest5> | im a bit lost now |
| 2021-05-15 16:52:12 | × | geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 265 seconds) |
| 2021-05-15 16:53:41 | × | cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2021-05-15 16:55:40 | <xenon-> | guest5, numerical literals are polymorphic. 1000 can be Int, Integer, Float, Double. calling / narrows the type down a bit, but not enough, because printf can also accept many different numerical types. |
| 2021-05-15 16:55:59 | <xenon-> | :t 1000 |
| 2021-05-15 16:56:01 | <lambdabot> | Num p => p |
| 2021-05-15 16:56:14 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds) |
| 2021-05-15 16:56:27 | <xenon-> | :t (fromIntegral 10 / 1000) |
| 2021-05-15 16:56:28 | <lambdabot> | Fractional a => a |
| 2021-05-15 16:57:19 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-05-15 16:57:26 | <kuribas> | Does template haskell resolve captured names from the calling environment? |
| 2021-05-15 16:57:36 | <int-e> | (this business is confused by defaulting for numerical types) |
| 2021-05-15 16:57:50 | <kuribas> | In the module where the TH is called? |
| 2021-05-15 16:58:15 | <kuribas> | Does that mean the calling module must import all relevant modules? |
| 2021-05-15 16:59:12 | <guest5> | okay, I think I've done everything you have said |
| 2021-05-15 16:59:19 | <guest5> | add parenthesis and the type |
| 2021-05-15 17:00:45 | <guest5> | https://paste.tomsmeding.com/rVS0XFpz |
| 2021-05-15 17:01:00 | <guest5> | sorry I'm very new to Haskell I'm struggling with the errors |
| 2021-05-15 17:01:52 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 252 seconds) |
| 2021-05-15 17:02:23 | → | Pickchea joins (~private@unaffiliated/pickchea) |
| 2021-05-15 17:03:15 | × | phaul quits (~phaul@ruby/staff/phaul) (Quit: :wq) |
| 2021-05-15 17:03:21 | <sm[m]> | guest5: printf is very prone to these kinds of errors. Add more type annotations to the arguments if it's not working out. Eg ("m " + listToString xs :: String) |
| 2021-05-15 17:03:22 | <int-e> | kuribas: it's complicated because of TH quotes: https://paste.debian.net/1197710/ |
| 2021-05-15 17:03:56 | <kuribas> | int-e: so, with quotes it's capturing from the defining module, without quotes from the calling module? |
| 2021-05-15 17:04:13 | <int-e> | kuribas: yes, pretty sure that's how it works |
| 2021-05-15 17:04:18 | <kuribas> | int-e: for example s = varE $ mkName "a" |
| 2021-05-15 17:04:22 | <kuribas> | right :) |
| 2021-05-15 17:05:13 | <xenon-> | this is not printf's fault |
| 2021-05-15 17:05:24 | <xenon-> | guest5 see the type of showFFloat |
| 2021-05-15 17:05:39 | <geekosaur> | looks to me like parens for showFFloat are in the wrong place? |
| 2021-05-15 17:05:47 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:8dd2:2363:77ad:18a2) |
| 2021-05-15 17:06:15 | <xenon-> | :t showFFloat (Just 3) (fromIntegral 10 / 1000 :: Float) |
| 2021-05-15 17:06:16 | <lambdabot> | ShowS |
| 2021-05-15 17:06:22 | <xenon-> | > showFFloat (Just 3) (fromIntegral 10 / 1000 :: Float) "" |
| 2021-05-15 17:06:23 | <lambdabot> | "0.010" |
| 2021-05-15 17:06:31 | <xenon-> | add "" at the end of the call |
| 2021-05-15 17:06:42 | × | _xor quits (~xor@74.215.46.133) (Quit: WeeChat 3.1) |
| 2021-05-15 17:06:52 | <int-e> | guest5: printf doesn't give good type errors. You can specify the intended type though... (printf "%-10s" :: String -> String), say, and then the type errors should become easier to digest |
| 2021-05-15 17:07:05 | <xenon-> | purpose of that is to allow efficient string concatenation |
| 2021-05-15 17:07:26 | <int-e> | guest5: note that "%-10s" specifies *one* string format, but you're giving it two strings... |
All times are in UTC.