Logs: freenode/#haskell
| 2021-05-11 22:22:30 | <m_shiraeeshi> | ski: no, I add it when I need to distinguish the type constructor from the data constructor when I have single data constructor in the declaration |
| 2021-05-11 22:22:32 | <ski> | newtype SortedList a = PromiseSorted [a] -- when the type is intended to model a subset of the representation type |
| 2021-05-11 22:22:49 | <m_shiraeeshi> | idk, Mk prefix seems ugly to me |
| 2021-05-11 22:23:09 | <m_shiraeeshi> | and I use data constructors more often then type constructors |
| 2021-05-11 22:23:33 | <m_shiraeeshi> | so I figured they should be short and concise |
| 2021-05-11 22:23:40 | × | vicfred quits (vicfred@gateway/vpn/mullvad/vicfred) (Read error: Connection reset by peer) |
| 2021-05-11 22:24:03 | <monochrom> | I think "Data" is too long. Also not future-proof. What if one day you s/data/newtype/ ? |
| 2021-05-11 22:24:16 | → | smerdyakov6 joins (~dan@5.146.195.164) |
| 2021-05-11 22:24:38 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-05-11 22:25:14 | × | Tesseraction quits (~Tesseract@unaffiliated/tesseraction) (Read error: Connection reset by peer) |
| 2021-05-11 22:25:42 | → | Tesseraction joins (~Tesseract@unaffiliated/tesseraction) |
| 2021-05-11 22:25:46 | × | smerdyakov quits (~dan@5.146.195.164) (Ping timeout: 240 seconds) |
| 2021-05-11 22:25:47 | smerdyakov6 | is now known as smerdyakov |
| 2021-05-11 22:25:47 | <ski> | newtype UnorderedPair a = Unorder {nondeterministicPeekOrdered :: (a,a)} -- one can imagine hopefully suggestive naming to be used when modelling factor/quotient types, as well |
| 2021-05-11 22:26:02 | <monochrom> | Perhaps consider "data X = X_ {_x :: Int}" and let it all degenerate into morse code... |
| 2021-05-11 22:26:11 | <m_shiraeeshi> | do people move from data to newtypes? what could be the reason to do that? optimisation? |
| 2021-05-11 22:26:24 | <ski> | m_shiraeeshi : i'd rather add `Data' to the data constructor, than the type constructor, in that case |
| 2021-05-11 22:26:35 | <ski> | m_shiraeeshi : change of internal representation ? |
| 2021-05-11 22:26:37 | <m_shiraeeshi> | hm, underscore could work |
| 2021-05-11 22:26:42 | <Ernest> | What about having the data constructor be lowercased, so just as a function which it is |
| 2021-05-11 22:26:47 | × | ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 265 seconds) |
| 2021-05-11 22:26:58 | <ski> | (e.g. between deep and shallow embedding) |
| 2021-05-11 22:26:59 | <monochrom> | Too late for that, Haskell requires capitalized. |
| 2021-05-11 22:27:32 | ← | shane parts (~shane@desk.roadwar.net) ("Textual IRC Client: www.textualapp.com") |
| 2021-05-11 22:27:36 | <geekosaur> | think about pattern matches, they need some way to distinguish constructors (structure) from variables (values) |
| 2021-05-11 22:27:38 | → | shane joins (~shane@desk.roadwar.net) |
| 2021-05-11 22:28:18 | <geekosaur> | case may not be the best way but it's the one the developers of Haskell came up with |
| 2021-05-11 22:28:37 | <Ernest> | Oh yeah |
| 2021-05-11 22:29:06 | × | shane quits (~shane@desk.roadwar.net) (Quit: ZNC 1.7.5+deb4 - https://znc.in) |
| 2021-05-11 22:29:07 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:692a:95b:a9cd:2f9) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-11 22:29:25 | → | shanemikel joins (~shanemike@desk.roadwar.net) |
| 2021-05-11 22:29:35 | <ski> | newtype Coyoneda f b = forall a. FmapIncl (a -> b) (f a) -- `FmapIncl f c = fmap f (incl c)' where `incl :: f a -> Coyoneda f a; incl = FmapIncl id' |
| 2021-05-11 22:29:36 | <Ernest> | I heard some negative opinions about pattern matching and that it was a mistake, but I didn't understand the reason why they said it was a mistake |
| 2021-05-11 22:29:45 | × | shanemikel quits (~shanemike@desk.roadwar.net) (Client Quit) |
| 2021-05-11 22:29:59 | <ski> | mistake, in which sense ? |
| 2021-05-11 22:30:03 | → | shanemikel joins (~shanemike@desk.roadwar.net) |
| 2021-05-11 22:30:24 | <Ernest> | Sounded like they were saying it should've not been invented or something |
| 2021-05-11 22:30:35 | <monochrom> | Never heard of that. |
| 2021-05-11 22:30:37 | <Ernest> | I'll try to find where I heard it, it was from a talk |
| 2021-05-11 22:30:43 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:692a:95b:a9cd:2f9) |
| 2021-05-11 22:30:43 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:692a:95b:a9cd:2f9) (Client Quit) |
| 2021-05-11 22:31:20 | <Cale> | Sounds like a poor opinion to me |
| 2021-05-11 22:31:33 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-11 22:32:10 | <ski> | perhaps they were talking about some particular aspect of, or particular design choice, in the design of pattern-matching in Haskell |
| 2021-05-11 22:32:10 | <monochrom> | https://xkcd.com/386/ applies |
| 2021-05-11 22:32:24 | <shanemikel> | Hey guys! I'm getting some type errors trying to implement the phantom types from "Fun With Type Functions" |
| 2021-05-11 22:32:49 | × | jgt_ quits (~jgt@92-247-237-116.spectrumnet.bg) (Ping timeout: 276 seconds) |
| 2021-05-11 22:33:31 | × | Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.) |
| 2021-05-11 22:33:33 | <Cale> | I can imagine that some people don't like the multiple-equations style of defining functions, and would prefer to express pattern matching using case (I use that style myself for the most part) |
| 2021-05-11 22:33:57 | <monochrom> | Also https://www.smbc-comics.com/comic/mind-3 |
| 2021-05-11 22:33:58 | <Ernest> | https://youtu.be/TVJa-V6U-XI?t=1215 |
| 2021-05-11 22:34:11 | <ski> | but if it's really about pattern-matching (on disjoint/discriminated/tagged union / algebraic data / sum / variant types / variant record types), then i would disagree |
| 2021-05-11 22:34:40 | × | elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 268 seconds) |
| 2021-05-11 22:35:42 | <monochrom> | I won't take time to listen to or comment on Nolen's talk. |
| 2021-05-11 22:35:43 | <ski> | oh, its interaction with abstract data types. i think pattern synonyms (and view patterns) is the answer here |
| 2021-05-11 22:36:12 | × | thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 258 seconds) |
| 2021-05-11 22:36:16 | <monochrom> | But Wadler's "views" still requires pattern matching, just not on internal unexported data constructors. |
| 2021-05-11 22:36:21 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds) |
| 2021-05-11 22:36:36 | <ski> | (it would be nice if one could export `data Foo = Blah .. | Bleh ..', but internally define `Blah' and `Bleh' as pattern synonyms, having represented `Foo' in a different way) |
| 2021-05-11 22:37:26 | <monochrom> | As usual, "some people misunderstand X and abuse it" is conflated with "X should not have been invented". |
| 2021-05-11 22:37:33 | <ski> | (also the "active patterns" of F# <https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/active-patterns> are relevant here) |
| 2021-05-11 22:39:04 | × | dpl__ quits (~dpl@77-121-78-163.chn.volia.net) (Read error: Connection reset by peer) |
| 2021-05-11 22:39:06 | → | xcmw joins (~textual@cpe-69-133-55-43.cinci.res.rr.com) |
| 2021-05-11 22:39:12 | <monochrom> | Hey let me go meta with "some people misunderstand and misuse 'should not have been invented'" >:) |
| 2021-05-11 22:39:30 | × | chimera quits (~chimera@168-182-134-95.pool.ukrtel.net) (Read error: Connection reset by peer) |
| 2021-05-11 22:39:46 | × | jluttine quits (~jluttine@85-23-66-6.bb.dnainternet.fi) (Ping timeout: 240 seconds) |
| 2021-05-11 22:40:15 | → | jluttine joins (~jluttine@85-23-66-6.bb.dnainternet.fi) |
| 2021-05-11 22:40:18 | → | chimera joins (~chimera@168-182-134-95.pool.ukrtel.net) |
| 2021-05-11 22:40:23 | × | coot quits (~coot@37.30.58.122.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-05-11 22:40:55 | <Ernest> | Well I wouldn't have dug further in my misunderstanding unprovoked hehe |
| 2021-05-11 22:41:02 | <monochrom> | My http://www.vex.net/~trebla/haskell/crossroad.xhtml explains why pattern matching is more natural. Frankly my perspective is I don't understand why it took so long to invent. I mean it's a natural logical conclusion of natural deduction which is 100 years old. |
| 2021-05-11 22:42:13 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-05-11 22:43:58 | → | apache8080 joins (~rishi@wsip-70-168-153-252.oc.oc.cox.net) |
| 2021-05-11 22:44:46 | × | usr25 quits (~J@41.red-83-58-207.dynamicip.rima-tde.net) (Quit: Bye) |
| 2021-05-11 22:46:24 | <ski> | @type \(Seq.viewl -> (a Seq.:< as)) -> (a,as) |
| 2021-05-11 22:46:25 | <lambdabot> | Seq.Seq a -> (a, Seq.Seq a) |
| 2021-05-11 22:46:38 | <ski> | @type (\(a :< as) -> (a,as)) :: Seq.Seq a -> (a,Seq.Seq a) |
| 2021-05-11 22:46:39 | <lambdabot> | Seq.Seq a -> (a, Seq.Seq a) |
| 2021-05-11 22:48:14 | <ski> | "pattern-matching on concrete data types is a horrible idea","you're matching concrete types, not abstractions" |
| 2021-05-11 22:48:43 | <ski> | @type Seq.viewl |
| 2021-05-11 22:48:44 | <lambdabot> | Seq.Seq a -> Seq.ViewL a |
| 2021-05-11 22:48:46 | <ski> | @type (Seq.:<) |
| 2021-05-11 22:48:47 | <lambdabot> | a -> Seq.Seq a -> Seq.ViewL a |
| 2021-05-11 22:48:59 | <ski> | is `ViewL' a concrete type, or an abstraction ? |
| 2021-05-11 22:49:22 | <monochrom> | Yeah that's blaming the wrong guy and barking up the wrong tree. |
| 2021-05-11 22:49:26 | <shanemikel> | In particular this paper: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/typefun.pdf |
| 2021-05-11 22:50:05 | <monochrom> | A decision to export a concrete type can be a horrible idea. |
| 2021-05-11 22:50:34 | <monochrom> | But someone has to work on the concrete type, for example the author of the library in question. |
| 2021-05-11 22:50:54 | <monochrom> | A type is never abstract to everyone. |
| 2021-05-11 22:51:06 | <monochrom> | Everyone is not equal. |
| 2021-05-11 22:51:17 | <shanemikel> | What is the pastebin y'all are using these days? |
| 2021-05-11 22:51:18 | <ski> | how about if you do the usual record OO thing, `data Widget = NewWidget { render :: IO (),frob :: Blah -> Widget,.. }' .. is `Widget' a concrete data type, or is it an abstraction, and iterface, to a possible multitude of different concrete implementations ? |
| 2021-05-11 22:51:24 | <m_shiraeeshi> | how about creating a concrete type that matches the abstraction level and then match it? |
| 2021-05-11 22:51:42 | <ski> | @paste |
| 2021-05-11 22:51:42 | <lambdabot> | A pastebin: https://paste.debian.net/ |
| 2021-05-11 22:51:52 | <ski> | @where paste |
| 2021-05-11 22:51:53 | <lambdabot> | Help us help you: please paste full code, input and/or output at e.g. https://paste.tomsmeding.com |
| 2021-05-11 22:52:06 | <ski> | shanemikel : the latter ^ is most used now, i think |
| 2021-05-11 22:52:06 | → | gemmaro_ja joins (~Thunderbi@240f:74:d1f0:1:1bf:3730:3a54:b192) |
| 2021-05-11 22:52:12 | <pjb> | shanemikel: http://ideone.com |
All times are in UTC.