Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-07 22:32:08 <haskellstudent> fresheyeball: regarding your last message, maybe this is related? https://stackoverflow.com/questions/26902960/ghc-could-not-execute-htfpp so maybe your build generate-html-dsl is stored in the .stack-work/dist/... folder, but it is not in the path at the time you are trying to use it. maybe you could try using an absolute path to see if that is the problem, for example: {-# OPTIONS_GHC -F -pgmF /home/user/Projects/yourproject/.
2021-04-07 22:32:08 <haskellstudent> stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/yourproject/generate-html-dsl #-}
2021-04-07 22:32:16 <Althar> Yes, ok that is what I am going for - so I guess I am failing to understand why the previous way of writing it didn't expand to the same thing
2021-04-07 22:32:29 <fresheyeball> haskellstudent: I figured it out, it needs to be in build tool depends
2021-04-07 22:32:35 <monochrom> "Type constructor symbols T introduced by type synonym declarations cannot be partially applied; it is a static error to use T without the full number of arguments." again.
2021-04-07 22:32:37 <haskellstudent> nice
2021-04-07 22:32:53 <monochrom> You have to get past that rule before it's meaningful to talk about the rest.
2021-04-07 22:33:13 <Althar> monochrom Sure, that's the sentence I don't quite understand/grasp then
2021-04-07 22:33:18 <monochrom> No expansion until you clear that rule.
2021-04-07 22:34:06 <monochrom> If you define "type T a b c d e f g" then you can only use it as "T Foo Bar John Mary Joe Alice Bob".
2021-04-07 22:34:15 <Althar> I'm probably getting confused with the terminology between type constructor, and synonym
2021-04-07 22:34:36 <monochrom> ResourceOpT is the type constructor.
2021-04-07 22:34:41 geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr)
2021-04-07 22:34:44 <Althar> ok
2021-04-07 22:35:10 <Althar> so the above only holds true if it is a type synonym? hence it working with StateT, or with my partial type constructor
2021-04-07 22:35:26 <Althar> but not in my original definition
2021-04-07 22:35:28 <monochrom> I defined my T to have formally 7 arguments. Now I'm stuck with using it with 7 arguments, I cannot supply fewer.
2021-04-07 22:35:31 × stree quits (~stree@68.36.8.116) (Ping timeout: 248 seconds)
2021-04-07 22:35:34 <Althar> ok
2021-04-07 22:35:49 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-07 22:35:55 <Althar> starting to make sense
2021-04-07 22:35:59 <Althar> sorry for going round in circles
2021-04-07 22:36:55 <Althar> As a final question then, is it better practice in Haskell, to define the instance for the most basic type, or am I right defining the instance for my more specific type?
2021-04-07 22:37:08 <Althar> So Option #A : 'instance (MonadIO m) => Logger ( ResourceOpT r m )'
2021-04-07 22:37:18 <Althar> Or Option #B : 'instance (MonadIO m) => Logger ( StateT s m )'
2021-04-07 22:37:31 <Althar> given at this stage they are the same
2021-04-07 22:37:43 machinedgod joins (~machinedg@24.105.81.50)
2021-04-07 22:38:29 <monochrom> False dichotomy. The correct decision is based on the purpose of the class, the purpose of the basic type, the purpose of the specific type.
2021-04-07 22:38:39 × dinciorip quits (~dincio@5.170.5.195) (Quit: WeeChat 3.1)
2021-04-07 22:39:53 <Althar> I might not want the user to use Logger in everything that uses StateT
2021-04-07 22:39:56 <monochrom> "instance Eq a => Eq [a]" makes more sense than "instance Eq [Int]" because Eq should work the same for [Int], [Char], [Anything].
2021-04-07 22:40:04 <Althar> sure
2021-04-07 22:40:33 <monochrom> But "instance MySpecialClass [Int]" can make more sense than "instance MySpecialClass [a]" if the purpose of MySpecialClass is special.
2021-04-07 22:41:07 × Synthetica quits (uid199651@gateway/web/irccloud.com/x-igiuipnjkspialln) (Quit: Connection closed for inactivity)
2021-04-07 22:41:50 × hpc quits (~juzz@ip98-169-35-13.dc.dc.cox.net) (Ping timeout: 268 seconds)
2021-04-07 22:41:51 <monochrom> The simplest thing to do is outlaw type synonyms.
2021-04-07 22:42:14 <Althar> ok, I think I've got it now
2021-04-07 22:42:25 <Althar> are type synonyms considered bad/dangerous then?
2021-04-07 22:42:38 <monochrom> If you intend an encapsulation then use "data" or "newtype". If you don't intend an encapsulation then just write out the full type expression. Simple and clear.
2021-04-07 22:42:57 <monochrom> Oh everyone else likes it.
2021-04-07 22:43:08 hpc joins (~juzz@ip98-169-35-13.dc.dc.cox.net)
2021-04-07 22:43:08 nbloomf joins (~nbloomf@2600:1700:ad14:3020:b94d:65d6:a9e1:d541)
2021-04-07 22:43:15 <dibblego> there is also the use-case "pronunciation", though I would not use type synonym for that either
2021-04-07 22:43:49 <Althar> ok, I think I've got enough to ponder about - thanks a lot for your help/explanations
2021-04-07 22:45:21 fiedlr joins (~fiedlr@83.148.33.254)
2021-04-07 22:45:51 <monochrom> 80% of the people mistake type synonyms for abstraction. They run into lots of confusions indeed.
2021-04-07 22:46:11 × Narinas quits (~Narinas@187-178-93-112.dynamic.axtel.net) (Ping timeout: 248 seconds)
2021-04-07 22:46:25 <monochrom> The other 20% correctly understand that it's like "#define MAXNUM 100" in C.
2021-04-07 22:46:45 <monochrom> There is benefit in "if one day I need to change 100 to 200 I just have to change it at one place".
2021-04-07 22:46:53 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-04-07 22:47:08 <monochrom> But this does not imply any abstraction, encapsulation, objectification, modularization.
2021-04-07 22:47:30 <dibblego> I've also seen "use newtype for type-safety"
2021-04-07 22:47:57 pavonia joins (~user@unaffiliated/siracusa)
2021-04-07 22:48:00 Narinas joins (~Narinas@187-178-93-112.dynamic.axtel.net)
2021-04-07 22:48:40 stree joins (~stree@68.36.8.116)
2021-04-07 22:48:57 gnumonic joins (~gnumonic@c-73-170-91-210.hsd1.ca.comcast.net)
2021-04-07 22:49:18 <Althar> Hopefully, I'll be one of the 20% one day :)
2021-04-07 22:49:23 × hiroaki_ quits (~hiroaki@2a02:908:4b18:8c40:bdf7:105d:7ce:39c2) (Ping timeout: 248 seconds)
2021-04-07 22:49:23 × hiroaki quits (~hiroaki@2a02:908:4b18:8c40:bdf7:105d:7ce:39c2) (Ping timeout: 248 seconds)
2021-04-07 22:49:41 × fiedlr quits (~fiedlr@83.148.33.254) (Ping timeout: 240 seconds)
2021-04-07 22:50:13 rprije joins (~rprije@59-102-63-15.tpgi.com.au)
2021-04-07 22:50:19 Alleria joins (~textual@2603-7000-3040-0000-d06d-9c04-03df-c710.res6.spectrum.com)
2021-04-07 22:50:43 Alleria is now known as Guest29374
2021-04-07 22:52:02 × rj quits (~x@gateway/tor-sasl/rj) (Quit: rj)
2021-04-07 22:52:06 × zebrag quits (~inkbottle@aaubervilliers-654-1-2-51.w83-200.abo.wanadoo.fr) (Read error: Connection reset by peer)
2021-04-07 22:52:24 zebrag joins (~inkbottle@aaubervilliers-654-1-2-51.w83-200.abo.wanadoo.fr)
2021-04-07 22:55:21 notzmv joins (~zmv@unaffiliated/zmv)
2021-04-07 22:55:24 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-07 22:59:40 <infinisil> I like how in Idris type synonyms are just variable definitions
2021-04-07 22:59:41 <d34df00d> To be fair, newtypes offer some degrees of type safety (and documentation, for that matter).
2021-04-07 22:59:55 × minoru_shiraeesh quits (~shiraeesh@109.166.57.223) (Ping timeout: 265 seconds)
2021-04-07 23:00:12 <infinisil> `type Foo = Bar` in Idris is `Foo : Type \n Foo = Bar`
2021-04-07 23:00:31 <d34df00d> I'd much rather have trade :: Currency -> Amount -> Deadline -> ... than trade :: Int -> Int -> Int -> ...
2021-04-07 23:00:37 <dibblego> that is not type-safety
2021-04-07 23:00:56 <monochrom> I don't doubt the value of "#define MAXNUM 100" either.
2021-04-07 23:01:07 <monochrom> I just doubt the belief that it's an abstraction.
2021-04-07 23:01:08 <d34df00d> Type safety is about proving that your programs don't exhibit properties you don't want and do exhibit the ones you do want.
2021-04-07 23:01:32 <d34df00d> A property of "don't accidentally pass amount where deadline is expected" is one example.
2021-04-07 23:01:33 <monochrom> When an error message spills the gut, you know you don't have an abstraction.
2021-04-07 23:01:34 <dibblego> Correct. newtype T = T U -- this program T exhibits the same properties as the program U
2021-04-07 23:01:42 <dibblego> no
2021-04-07 23:01:53 <d34df00d> A property of "don't add an amount to a deadline" is another one.
2021-04-07 23:02:10 <dibblego> these are not examples of the correct statement
2021-04-07 23:02:14 <d34df00d> dibblego: this is not a program, really.
2021-04-07 23:02:31 <d34df00d> I mean, this is some Haskell source code, but it has no runtime behaviour, so you'll need extra lines of code around.
2021-04-07 23:08:35 × geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 248 seconds)
2021-04-07 23:09:41 × Ranhir quits (~Ranhir@157.97.53.139) (Ping timeout: 240 seconds)
2021-04-07 23:20:20 Ranhir joins (~Ranhir@157.97.53.139)
2021-04-07 23:21:12 atraii joins (~atraii@2601:681:8700:c471:182c:49ac:c430:1f21)
2021-04-07 23:21:24 × lotuseater quits (~user@p200300e787030b0000a24874ceb5ca88.dip0.t-ipconnect.de) (Quit: ERC (IRC client for Emacs 27.1))
2021-04-07 23:24:31 × thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 245 seconds)
2021-04-07 23:27:40 × cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Quit: leaving)
2021-04-07 23:28:15 pfurla joins (~pfurla@ool-182ed2e2.dyn.optonline.net)
2021-04-07 23:31:33 × Althar quits (5e039f1a@94.3.159.26) (Quit: Connection closed)
2021-04-07 23:32:38 × ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Remote host closed the connection)
2021-04-07 23:32:56 × dxld quits (~dxld@80-109-136-248.cable.dynamic.surfer.at) (Read error: Connection reset by peer)
2021-04-07 23:33:09 dxld joins (~dxld@rush.pub.dxld.at)
2021-04-07 23:33:40 ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-04-07 23:34:16 × Codaraxis quits (Codaraxis@gateway/vpn/mullvad/codaraxis) (Remote host closed the connection)
2021-04-07 23:34:39 Codaraxis joins (Codaraxis@gateway/vpn/mullvad/codaraxis)

All times are in UTC.