Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 368 369 370 371 372 373 374 375 376 377 378 .. 17995
1,799,403 events total
2021-06-09 18:00:31 <yahb> ski: *** Exception: <interactive>:7:5-17: Non-exhaustive patterns in True
2021-06-09 18:00:48 <Izem> ok, so I suspect there are different classes of types
2021-06-09 18:01:02 <Izem> data is for algebraic data types iirc
2021-06-09 18:01:26 <ski> `type' declares a new name (possibly parameterized) for an existing type. a type synonym
2021-06-09 18:02:07 <ski> `data' and `newtype' declares new types, together with ways to construct values of the new type
2021-06-09 18:02:15 <Izem> does haskell have symbols?
2021-06-09 18:02:22 <Izem> no need right?
2021-06-09 18:02:23 <ski> Izem : yes (algebraic data types)
2021-06-09 18:02:26 <ski> no symbols
2021-06-09 18:02:28 <Izem> ah kk
2021-06-09 18:02:42 <ski> you can use constant data constructors, mostly
2021-06-09 18:02:53 <Izem> interesting
2021-06-09 18:03:15 <ski> data Weekday = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
2021-06-09 18:03:45 <Izem> are True and False special?
2021-06-09 18:04:18 × tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2021-06-09 18:04:20 <edmundnoble_> Nope
2021-06-09 18:04:26 <edmundnoble_> `data Bool = True | False`
2021-06-09 18:04:26 <boxscape> only in the sense that they are used by a few builtin constructs, but Bool is declared as a regular type
2021-06-09 18:04:39 <edmundnoble_> ^
2021-06-09 18:05:39 <DigitalKiwi> data Bool = True | False | FileNotFound
2021-06-09 18:05:56 <edmundnoble_> If you want to define a new datatype, it will be with either `data` or `newtype`, and `newtype` only has subtle operational differences from `data`, it's not fundamentally different at all
2021-06-09 18:07:11 <edmundnoble_> Type aliases, defined with `type`, have no semantic content and with the exception of a few small things (like error messages changing) could be implemented entirely with preprocessor directives replacing the alias with its contents
2021-06-09 18:07:14 <ski> Izem : well, there's `OverloadedLabels' <https://downloads.haskell.org/~ghc/8.10.5/docs/html/users_guide/glasgow_exts.html#extension-OverloadedLabels>
2021-06-09 18:07:18 <edmundnoble_> (er, definition, more than contents)
2021-06-09 18:07:52 <ski> @src Bool
2021-06-09 18:07:52 <lambdabot> data Bool = False | True deriving (Eq, Ord)
2021-06-09 18:08:16 <Izem> cool
2021-06-09 18:08:25 <ski> (`False' comes before `True', in the `Ord' instance (and also in `Enum',`Bounded' and `Ix')
2021-06-09 18:09:39 <ski> `Bool' has special support in the `if'-`then'-`else' syntactic sugar (one could just as well use `case'-`of'), and in guards (occuring in pattern-matching, and in list comprehensions)
2021-06-09 18:09:39 Erutuon joins (~Erutuon@user/erutuon)
2021-06-09 18:09:45 <vaibhavsagar[m]> can I have a `hie.yaml` configuration that specifies both cabal and stack?
2021-06-09 18:10:19 <delYsid> tomsmeding: Oh, very cool you just picked that up from chatlog! If you send me a link, I can recheck
2021-06-09 18:10:24 <vaibhavsagar[m]> this project (https://github.com/Avi-D-coder/implicit-hie) seems to have two different files that need to be moved into the correct place
2021-06-09 18:10:34 <Izem> what's the difference between case-of and guards?
2021-06-09 18:10:48 <ephemient> if-then-else desugars to case-of in core, IIRC
2021-06-09 18:11:14 <ski> what's the difference between an apple and a saxophone ?
2021-06-09 18:11:25 <ski> they are not directly comparable
2021-06-09 18:11:38 <boxscape> Izem case-of is used to check whether a value has a certain structure, i.e. which constructors its made up of. Guards are used to check arbitrary boolean conditions
2021-06-09 18:11:52 <Izem> I see
2021-06-09 18:11:59 <ski> guards can occur both in `case'-`of', and in "ordinary" function parameter pattern-matching
2021-06-09 18:12:01 <tomsmeding> delYsid: I guess the same links works :) https://paste.tomsmeding.com/NBPCg1ip
2021-06-09 18:12:16 <vaibhavsagar[m]> guards desugar to case-of too IIRC
2021-06-09 18:12:29 <Izem> interesting
2021-06-09 18:12:51 <Izem> guard clauses are really novel
2021-06-09 18:13:15 cactinoob joins (~cactinoob@adsl-64-237-237-9.prtc.net)
2021-06-09 18:13:27 <ski> @src filter
2021-06-09 18:13:27 <lambdabot> filter _ [] = []
2021-06-09 18:13:27 <lambdabot> filter p (x:xs)
2021-06-09 18:13:27 <lambdabot> | p x = x : filter p xs
2021-06-09 18:13:27 <lambdabot> | otherwise = filter p xs
2021-06-09 18:13:41 <ski> this is equivalent to
2021-06-09 18:14:03 <ski> filter p xs0 = case xs0 of
2021-06-09 18:14:43 <ski> [ ] -> [ ]
2021-06-09 18:14:49 <ski> x:xs
2021-06-09 18:15:04 <ski> | p x -> x : filter p xs
2021-06-09 18:15:23 <ski> | otherwise -> filter p xs
2021-06-09 18:16:08 <Izem> thanks
2021-06-09 18:16:08 × ikex quits (~ash@user/ikex) (Ping timeout: 268 seconds)
2021-06-09 18:18:31 <ski> Miranda had guards. i'd guess ISWIM had them, too
2021-06-09 18:19:08 kaizen joins (uid501599@id-501599.brockwell.irccloud.com)
2021-06-09 18:19:34 <Izem> yep, though they are different than haskell
2021-06-09 18:19:48 <Izem> it's like `foo, if bar`
2021-06-09 18:20:17 <delYsid> tomsmeding: Woohoo! Thanks for fixing the web! :-)
2021-06-09 18:20:23 <delYsid> (IOW, works for me now)
2021-06-09 18:20:38 <tomsmeding> delYsid: the line numbers are still kind of borked in lynx, but at least you can read the code :)
2021-06-09 18:21:06 <delYsid> yeah, about 90% of all paste thingies have the same line number problem, so I guess thats fine
2021-06-09 18:21:16 <tomsmeding> (they work in elinks)
2021-06-09 18:21:31 <tomsmeding> (suggests to me that perhaps lynx has some weird handling of html tables)
2021-06-09 18:22:11 <delYsid> Interesting. I am too old to change browsers, but I really need to remember that one
2021-06-09 18:22:54 <ski> hm, on a quick scan through Peter J. Landin's "The Next 700 Programming Languages" in 1966-03 at <http://thecorememory.com/Next_700.pdf>, i don't see guards, just conditionals
2021-06-09 18:23:06 <ski> Izem : yep
2021-06-09 18:23:26 <delYsid> Now, if someone could fix hackage source links please ... it drives me crazy not being able to casually look at sources, always have to fetch with git and find the reference by hand...
2021-06-09 18:23:39 <delYsid> But I guess that train has left the station.
2021-06-09 18:26:00 <sm[m]> delYsid: I use haddock's "source" links on hackage all the time
2021-06-09 18:26:56 <tomsmeding> sm[m]: in a text-mode browser they suck heavily because the tooltips are inlined
2021-06-09 18:27:07 <sm[m]> ah
2021-06-09 18:27:30 tomsmeding wonders how hard it would be to make a basic proxy that filters out those tooltips
2021-06-09 18:27:37 <sm[m]> Haskell Foundation is keen on accessibility, it could be worth raising on discourse
2021-06-09 18:27:44 <tomsmeding> delYsid: ^
2021-06-09 18:30:28 × fabfianda quits (~fabfianda@mob-5-90-243-109.net.vodafone.it) (Read error: Connection reset by peer)
2021-06-09 18:30:36 <boxscape> I wish haddock source links worked across packages
2021-06-09 18:30:41 alphacath joins (~alpha@host-79-36-63-89.retail.telecomitalia.it)
2021-06-09 18:30:58 <boxscape> I guess that's not really feasible?
2021-06-09 18:31:31 <Rembane_> I don't think I know the problem good enough, so I think it's 100% feasible.
2021-06-09 18:31:47 <boxscape> nice
2021-06-09 18:33:08 alphacath parts (~alpha@host-79-36-63-89.retail.telecomitalia.it) ()
2021-06-09 18:33:13 <Rembane_> Because every package knows which other packages it depends on, and if those packages are available somewhere that's linkable, it should be possible to create a link to that place. Either locally or on hackage.
2021-06-09 18:34:12 mikoto-chan joins (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be)
2021-06-09 18:34:25 waleee joins (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd)
2021-06-09 18:34:28 <boxscape> hmm I suppose the hackage URLs are pretty stable
2021-06-09 18:35:31 <tomsmeding> sometimes I see hackage links in doc text that are supposed to go to a different package, but that seem to "strip off one path component too little"
2021-06-09 18:35:51 <tomsmeding> so you get pkgA-1.0/pkgB-1.0/module.html
2021-06-09 18:36:18 × Bartosz quits (~textual@24.35.90.211) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-06-09 18:36:20 <boxscape> interestingly the source link for Bool points to a different package (ghc-prim) https://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Bool.html#t:Bool
2021-06-09 18:36:22 <boxscape> but it 404s
2021-06-09 18:36:40 <boxscape> tomsmeding oh it does exactly what you're saying
2021-06-09 18:37:21 <tomsmeding> oh the whole link is also wrong
2021-06-09 18:37:41 <tomsmeding> it goes to base-4.15.0.0/ghc-prim-0.7.0/src/GHC-Types.html#Bool but the correct path is ghc-prim-0.7.0/docs/src/GHC-Types.html#Bool
2021-06-09 18:37:44 <tomsmeding> note the /docs/
2021-06-09 18:37:46 <boxscape> yeah

All times are in UTC.