Haskell

5 readers
1 users here now

**The Haskell programming language community.** Daily news and info about all things Haskell related: practical stuff, theory, types, libraries, jobs, patches, releases, events and conferences and more... ### Links - Get Started with Haskell

founded 2 years ago
176
 
 

Hi everyone, The Cabal team would like to ask our users if anyone would object to the Nix Integration being removed (following a reasonable deprecation cycle). It has been reported to us that the feature is non-functional, misleading and the documentation lacking.

177
 
 

Abstract: We introduce the framework FreeCHR, which formalizes the embedding of Constraint Handling Rules (CHR) into a host-language, using the concept of initial algebra semantics from category theory, to establish a high-level implementation scheme for CHR, as well as a common formalization for both theory and practice. We propose a lifting of the syntax of CHR via an endofunctor in the category Set and a lifting of the operational semantics, using the free algebra, generated by the endofunctor. We then lift the very abstract operational semantics of CHR into FreeCHR, and give proofs for soundness and completeness w.r.t. their original definition.

Haskell Source: https://github.com/SRechenberger/free-chr-hs

178
1
submitted 2 years ago* (last edited 2 years ago) by jaror@kbin.social to c/haskell@kbin.social
 
 

Which error message do you find easier to read?

GHC-style:

Hangman.hs:46:32: error:
    * Couldn't match type '[Char]' with 'Char'
      Expected type: Char
        Actual type: String
    * In the first argument of 'makeGuess', namely 'letterInput'
      In the first argument of 'gameLoop', namely
        '(makeGuess letterInput gs)'
      In the expression: gameLoop (makeGuess letterInput gs)
   |
46 |       else gameLoop (makeGuess letterInput gs)
   |                                ^^^^^^^^^^^

Elm-style:

-- Type mismatch ---------------------------------------------------- Hangman.hs

46 |       else gameLoop (makeGuess letterInput gs)
                                    ^^^^^^^^^^^
Couldn't match type '[Char]' with 'Char'

Actual type:

    String

Expected type:

    Char

#haskell #programminglanguages

179
180
3
submitted 2 years ago* (last edited 2 years ago) by jaror@kbin.social to c/haskell@kbin.social
 
 

Arnaud Spiwack is interviewed by Matthías Páll Gissurarson and Joachim Breitner. We learn all about linear types in Haskell, how linear types go beyond Rust's ownership system and why it's not always best to type check everything in core. We conclude with a peek into the many activities of Arnaud's employer, Tweag.

181
 
 

Use this thread to ask any Haskell related questions which you think doesn't deserve a thread of their own (if you're unsure, feel free to ask your question as a new thread). Ask away!

182
 
 

Hi, If you are a library maintainer or a commercial user of Haskell, we’ve got good news for you! We’ve created a template project for running GHC nightly builds. This will allow you to detect incompatibilities before they make it into a GHC release and inform the GHC developers! You can check it out here.

The template project uses GitHub Actions to automatically install the nightly GHC release through ghcup, and uses head.hackage to build your project in a cron job. If the build fails, it’ll ...

183
 
 

Perhaps we could also have a cabal doctests command?

184
 
 

The GHC developers are very pleased to announce the availability of the first alpha prerelease of GHC 9.8.1. Binary distributions, source distributions, and documentation are available at downloads.haskell.org. GHC 9.8 will bring a number of new features and improvements, including:

  • Preliminary support the TypeApplications language extension, allowing types to be bound in type declarations.
  • Support for the ExtendedLiterals extension, providing syntax for non-word-...
185
 
 

We built an open source Android app for Private Storage, with Haskell, in six months.

186
187
 
 

Today, 2023-07-26, at 1000 UTC (that's less than 30 minutes from the time of this announcement!) we are streaming the 8th episode of the Haskell Unfolder live on YouTube:

https://www.youtube.com/watch?v=V7673JaWXaA&list=PLD8gywOEY4HaG5VSrKVnHxCptlJv2GAn7&index=8

Many of Haskell's abstractions come with laws; well-known examples include the Functor type class with the functor laws and the Monad type class with the monad laws, but this is not limited to type classes; for example, lenses come with a set of laws, too. To people without a mathematical background such laws may seem intimidating; how would one even start to think about proving them for our own abstractions? In this episode of The Haskell Unfolder we will discuss examples of these laws, show how to prove them, and discuss common techniques for such proofs, including induction. We will also discuss why these laws matter; what goes wrong when they do not hold?

The Haskell Unfolder is a YouTube series about all things Haskell hosted by Edsko de Vries and Andres Löh, with episodes appearing approximately every two weeks.

We also have a GitHub repository with the code samples from the episodes:

https://github.com/well-typed/unfolder

And we have a public Google calendar listing the planned schedule:

https://calendar.google.com/calendar/u/0/embed?src=c_327de9ca66caa0307fd99de5b0e3fdd2ad1111ae857bd21659166c74b2b974f0@group.calendar.google.com

(or ICal: https://calendar.google.com/calendar/ical/c_327de9ca66caa0307fd99de5b0e3fdd2ad1111ae857bd21659166c74b2b974f0%40group.calendar.google.com/public/basic.ics )

188
 
 

GHC Proposal #601 proposes a lifecycle for Haskell language extensions and an associated system of compiler warnings. The lifecycle categorizes language extensions as being one of the following:

  • An experimental extension, subject to rapid evolution (e.g. LinearTypes)
  • A mature extension, to which changes are not expected (e.g. DeriveFunctor)
  • A deprecated extension, which will be removed from an imminent GHC release
  • A legacy extension, which is generally considered to be a design dead-end but th...
189
 
 

I finally found a decent definition of free alternatives:

newtype Free f a = Free { alts :: [Free' f a] } deriving Functor
instance Applicative (Free f) where
  pure = Free . pure . Pure
  Free ps <*> q0 = asum $ map (`apL` q0) ps where
    apL (Pure f) q = f <$> q
    apL (Free' x p) q = Free $ pure $ Free' x $ flip <$> p <*> q
instance Alternative (Free f) where
  empty = Free empty
  Free ps <|> Free qs = Free (ps <|> qs)
data Free' f a = Pure a | forall x. Free' (f x) (Free f (x -> a))
deriving instance Functor (Free' f)

#haskell

190
 
 

A fun application of circular programming

191
 
 

Hi all!

I wanted to make a fair bit of progress before announcing it, but a few weeks ago, I started working on lightweight bindings to the Botan cryptography library's C FFI. Initially, I was trying to revive the defunct Z-Botan bindings, but stripping it of its non-building dependencies proved to be infeasible, and the embedded version of Botan also proved to be out of date. Rather than give up, I decided to make a project of it, and start from scratch with fresh bindings to the latest version in modern Haskell.

This approach has been extremely rewarding, and today, I am proud to share that I have hit a wonderful milestone - I am halfway through implementing the low-level 1:1 bindings.

Right now, the bindings support:

  • Hashing
  • Message authentication codes
  • Symmetric ciphers
  • Block cipher modes
  • Public key signatures
  • Bcrypt and Password hashing
  • Random number generators
  • Base16 and Base64 encoding

Frankly, it is awkward to use, isn't versioned yet, and does not even have any algorithm constants (yet!), but as long as you can read the Botan C FFI docs, it works - and if everything keeps going as smoothly as it has, a friendlier high-level interface isn't too far away.

I don't have a project page yet, but if you want to follow this project, you can check out the repo, or you can follow the devlog on the Haskell Discourse where I've been more-or-less posting daily.

192
 
 

News about the Haskell programming language from 2023-07-20.

193
 
 

In this episode, Bartosz Milewski is interviewed by Wouter Swierstra and Andres Löh. Bartosz shares his thoughts on the "fringe topics" in programming, from C++ templates to category theory in Haskell. How he considers monads to be like fingers sticking out of the water. And he'll talk a little bit about his upcoming book and his thoughts on linear types.

194
195
 
 

Use this thread to ask any Haskell related questions which you think doesn't deserve a thread of their own. Ask away!