26
7
27
7
28
14

Basic optics: lenses, prisms, and traversals in Haskell

Lenses are becoming an increasingly important part of a Haskeller’s toolkit. Yet, when first approaching them, people may feel buried under a myriad of different lens-like thingies, and the complexity of some of the libraries implementing those concepts, like lens.

The goal of this talk is to provide a conceptual overview of three of the most important kinds of optics, namely lenses, prisms, and traversals. For most data types, those optics can be automatically generated, something we shall discuss. Finally, we shall look at one useful application of optics: treating semi-structured data such as JSON documents.

29
6
30
5
31
7
32
4
33
7
34
7
35
8
36
3
37
3
GHC 9.4.8 is now available (discourse.haskell.org)
38
3

Joachim Breitner and David Christiansen interview John MacFarlane, a professor of philosophy at UC Berkeley, but also the author of the popular pandoc document conversion tool, which has been around half as long as Haskell itself. He also explains the principle of uniformity as a design goal for lightweight markup languages, the relationship between philosophy and programming, and along the way he helps David with his markdown difficulties.

39
1
40
1
Announcing Updo (blockscope.com)
41
1
42
1

This is a spot where you can ask anything that you feel doesn't deserve its own post, no matter how small or simple it is!

43
1
submitted 7 months ago by bss03@infosec.pub to c/haskell@programming.dev

On /r/Haskell there was a pinned, monthly thread so that people could ask questions without creating a new top-level post.

  • I'd like to increase traffic to here (or some other Haskell Fediverse threaded-conversation group). Do you think a thread like that might help?
  • Does pinning work here? It's probably not necessary given the posts/month currently, but I suppose it's something to keep in mind.
  • Anyone got a link to Lemmy/KBin/ActivityPub Haskell library that I could use to write a bot, or some other way to schedule a post for yyyy-mm-01T00:00:00Z ?
44
2

cross-posted from: https://programming.dev/post/5838448

I came across this semi-randomly by using Search Marginalia to find information on functional programming courses.

I also very much enjoyed the two articles referenced in the footnotes.

45
1
46
1
submitted 8 months ago by bss03@infosec.pub to c/haskell@programming.dev

cross-posted from: https://kbin.social/m/haskell/t/592680

News about the Haskell programming language from 2023-11-02.

47
1
submitted 8 months ago by bss03@infosec.pub to c/haskell@programming.dev

cross-posted from: https://kbin.social/m/haskell/t/572329

News about the Haskell programming language from 2023-10-26.

48
1
submitted 8 months ago by bss03@infosec.pub to c/haskell@programming.dev

cross-posted from: https://kbin.social/m/haskell/t/552503

News about the Haskell programming language from 2023-10-19.

49
1
submitted 8 months ago by bss03@infosec.pub to c/haskell@programming.dev

cross-posted from: https://kbin.social/m/haskell/t/533616

News about the Haskell programming language from 2023-10-12.

50
1
CSV Parsing (mander.xyz)
submitted 8 months ago* (last edited 8 months ago) by mrh@mander.xyz to c/haskell@programming.dev

New-ish to Haskell. Can't figure out the best way to get Cassava (Data.Csv) to do what I want. Can't tell if I'm missing some haskell type idioms or common knowledge or what.

Task: I need to read in a CSV, but I don't know what the headers/columns are going to be ahead of time. The user will provide input to say which headers from the CSV they want processed, but I won't know where (index-wise) those columns will be in the CSV, nor how many total columns there will be (either specified by the user or total). Say I have a [String] which lists the headers they want.

Cassava is able to read CSVs with and without headers.

Without headers Cassava can read in entire rows, even if it doesn't know how many columns are in that row. But then I wouldn't have the header data to filter for the values that I need.

With headers Cassava requires(?) you to define a record type instantiating its FromNamedRecord typeclass, which is how you access parts of the column by name (using the record fields). But in order for this to be well defined you need to know ahead of time everything about the headers: their names, their quantity, and their order. You then emulate that in your record type.

Hopefully I'm missing something obvious, but it feels a lot like I have my hands tied behind my back dealing with the types provided by Cassava.

Help greatly appreciated :)

view more: ‹ prev next ›

Haskell

372 readers
2 users here now

founded 1 year ago
MODERATORS