2025/07/30

Newest at the top

2025-07-30 17:05:29 +0200 <mauke> it doesn't really generalize because 'import' takes module names, not type names
2025-07-30 17:03:58 +0200caubert(~caubert@user/caubert) (Ping timeout: 240 seconds)
2025-07-30 17:03:56 +0200 <Guest94> 19 % 15
2025-07-30 17:03:56 +0200 <Guest94> Stdm> 2%3 + 3%5
2025-07-30 17:03:55 +0200 <Guest94> 2 % 3
2025-07-30 17:03:55 +0200 <Guest94> Stdm> 2/3::Ratio Integer
2025-07-30 17:03:54 +0200 <Guest94> Hugs> :load Stmd.lhs
2025-07-30 17:03:23 +0200 <Guest94> Indeed it works! I suppose for any other types I will write "import type" just below ">module Stdm where". I hope I have not been too much trouble, and if you could point me to a resource where I can learn how to deal with the simple issues of the type (pun intended?) I have been concerned with, I would be most grateful
2025-07-30 16:56:45 +0200 <mauke> Guest94: try https://paste.tomsmeding.com/6JyH5IMV/raw/1
2025-07-30 16:56:05 +0200ljdarj(~Thunderbi@user/ljdarj) ljdarj
2025-07-30 16:55:01 +0200Frostillicus(~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net)
2025-07-30 16:53:57 +0200 <Guest94> https://www.dcs.gla.ac.uk/~jtod/discrete-mathematics/Stdm.lhs
2025-07-30 16:53:57 +0200 <Guest94> I am having trouble copy-pasting from vim (first time I've had to do so, so I guess I'll install the +xterm_clipboard feature), but I can show you the webpage where it is hosted:
2025-07-30 16:47:58 +0200Frostillicus(~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Read error: Connection reset by peer)
2025-07-30 16:46:48 +0200 <mauke> (once you've posted it, paste the URL here)
2025-07-30 16:45:54 +0200 <mauke> yeah
2025-07-30 16:45:50 +0200 <mauke> oh, it's \begin{code} ... \end{code}
2025-07-30 16:45:39 +0200 <Guest94> but let me send the file first
2025-07-30 16:45:39 +0200 <Guest94> *import Data.Ratio
2025-07-30 16:45:21 +0200 <Guest94> I did add the > before import
2025-07-30 16:45:06 +0200 <mauke> ah, lhs. that means it is in "literate haskell" format, which defaults to documentation/comments. any haskell code must be explicitly marked by a preceding ">" or by including a whole section in \begin{haskell} ... \end{haskell}
2025-07-30 16:44:10 +0200 <mauke> can you post the whole Stdm.lhs file at https://paste.tomsmeding.com/ ?
2025-07-30 16:43:14 +0200 <Guest94> ERROR "./Stdm.lhs":42 - Program line next to comment
2025-07-30 16:43:14 +0200 <Guest94> Hugs> :load Stdm
2025-07-30 16:43:13 +0200 <Guest94> I followed your advice (I hope), and, after rerunning things, got:
2025-07-30 16:43:13 +0200 <Guest94> I spent some time trying to paste in some of the code so you can see how it looks, but for some reason any portion I paste pastes the whole file. Is it an idiosincracy for each line to be preceded by a >?
2025-07-30 16:41:22 +0200 <mauke> that is, I don't think the relative order of 'import' lines matters
2025-07-30 16:41:13 +0200 <mauke> I don't think so, as long as it comes before local declarations in that module
2025-07-30 16:38:23 +0200 <Guest94> Indeed there is. Does it matter whether I import the Ratio type on some line after it?
2025-07-30 16:38:16 +0200Guest94(~Guest94@cpc147822-brnt4-2-0-cust196.4-2.cable.virginm.net)
2025-07-30 16:38:05 +0200Guest94(~Guest94@cpc147822-brnt4-2-0-cust196.4-2.cable.virginm.net) (Quit: Client closed)
2025-07-30 16:35:21 +0200Lycurgus(~juan@user/Lycurgus) Lycurgus
2025-07-30 16:33:32 +0200lortabac(~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.5.2)
2025-07-30 16:32:27 +0200 <mauke> Guest94: ^
2025-07-30 16:32:10 +0200 <mauke> (I assume there will be a 'module Stdm where' line followed by some existing imports)
2025-07-30 16:31:04 +0200 <mauke> that said, try adding 'import Data.Ratio' near the top of Stdm.hs
2025-07-30 16:30:46 +0200 <mauke> hugs is pretty ancient; ghci is the up-to-date haskell repl
2025-07-30 16:23:27 +0200 <Guest94> Are there any resources anyone here could point me to that I may help myself? Most of the other code runs fine, so I should be able to get through the book without any issues, but I ask the above in case this is a sign of some potentially serious issue that will bite me later.
2025-07-30 16:23:27 +0200 <Guest94> I have to add some code to the Stdm file I am loading, or do something else)
2025-07-30 16:23:26 +0200 <Guest94> Where Stdm is the file created by the authors for working through the examples and exercises in the book. I have not found any information online on how to proceed other than some suggestions to "import" the datatype Ratio (the quotation marks are meant to signal that I am unsure of the meaning of this term in a Haskell context, e.g. I am unsure if
2025-07-30 16:23:26 +0200 <Guest94> ERROR - Undefined type constructor "Ratio"
2025-07-30 16:23:25 +0200 <Guest94> Stdm> 2/3 :: Ratio Integer
2025-07-30 16:23:25 +0200 <Guest94> Good afternoon, I am a complete beginner when it comes to Haskell, which I have picked up to follow along with the book "Discrete Mathematics Using a Computer", which uses Hugs 98. I have encountered an issue with using the Ratio Integer type, specifically:
2025-07-30 16:16:21 +0200fp(~Thunderbi@2001:708:20:1406::10c5) (Ping timeout: 248 seconds)
2025-07-30 16:14:22 +0200CiaoSen(~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) CiaoSen
2025-07-30 16:06:57 +0200ouilemur(~jgmerritt@user/ouilemur) ouilemur
2025-07-30 16:04:31 +0200Guest94(~Guest94@cpc147822-brnt4-2-0-cust196.4-2.cable.virginm.net)
2025-07-30 16:04:22 +0200pyooquepuke
2025-07-30 16:04:22 +0200puke(~puke@user/puke) (Killed (zirconium.libera.chat (Nickname regained by services)))
2025-07-30 16:04:22 +0200pyooque(~puke@user/puke) puke