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
151
 
 

Learn how to combine the best of both TypeScript and Haskell for frontend development. TypeScript developers will learn how to take the reactive principles that made React successful to the next level with pure Functional Reactive Programming (FRP). Haskell developers on the other hand will learn how to easily integrate with the broader JavaScript ecosystem.

Links:
React: https://hackage.haskell.org/package/r...
reactive-banana: https://hackage.haskell.org/package/r...,
https://hackage.haskell.org/package/r...

152
 
 

News about the Haskell programming language from 2023-08-24.

153
 
 

This episode's guest is Ranjit Jhala. We discuss how Ranjit developed Liquid Haskell as a litmus test, because if Haskell programmer's won't use Liquid Types, no one will. We also hear how writing Haskell is a joy and how you should never underestimate your students.

154
155
 
 

Sometimes ImpredicativeTypes can be a good replacement for DeepSubsumption: https://stackoverflow.com/a/76936438/15207568

#haskell

156
 
 

The work that we do and the technologies we use are reflections of our values. So, what are the core FP values?

157
 
 

Haddock is the documentation generation tool for Haskell.

Recently, Mercury asked us to investigate performance problems in Haddock that were preventing their developers from using it effectively.

At a high level, the work covered by this post has resulted in Haddock’s memory usage being roughly halved. The full set of Haddock and GHC changes resulting in these improvements will be shipped with GHC 9.8.

All this profiling and debugging work was completed using the eventlog2html and ghc-debug tools.

158
 
 

Answering the question raised at the end of Part 1, we take a look at how a hypothetical Strict Haskell would tie the compilers hands despite pervasive purity. We also examine how laziness permits optimizations that come with no intrinsic cost and compare its benefits to a strict language with opt-in laziness.

159
160
 
 

Consider the following two implementations of a 'map' function for arrays. Can you guess which one of them is the fastest without running them? (Please ignore the uses of unsafeCoerce :P)

Required imports:

import Data.Primitive.Array
import Control.Monad.ST.Strict
import Unsafe.Coerce

Version 1:

mapArray1 :: forall a b. (a -> b) -> Array a -> Array b
mapArray1 f arr = runST $
  let n = length arr in
  thawArray arr 0 n >>= \m ->
  let
    go i
      | i < n = do
        x <- readArray m i
        writeArray m i $! unsafeCoerce @b @a (f x)
        go (i + 1)
      | otherwise = do
        arr' <- unsafeFreezeArray m
        return (unsafeCoerce @(Array a) @(Array b) arr')
  in
    go 0

Version 2:

mapArray2 :: forall a b. (a -> b) -> Array a -> Array b
mapArray2 f arr =
  let n = length arr in
  createArray n (unsafeCoerce @() @b ()) $ \m ->
    let
      go i
        | i < n = do
          writeArray m i $! f $! indexArray arr i
          go (i + 1)
        | otherwise = return ()
    in
      go 0

161
 
 

News about the Haskell programming language from 2023-08-17.

162
 
 

Generate contextually sensible fuzz tests for servant apps

163
 
 

It’s well known in the Haskell world that type class instances cannot be overridden. When you have an instance in scope, you are stuck with it. Is this a feature? Is this a bug? Maybe either depending on the problem you are facing. I have my own opinions, but let me lay out the case for wanting to be able to override instances.

164
 
 

Laziness is a critical but often maligned aspect of Haskell, and as this video argues, it is frequently misunderstood. In this video, Alexis explains how even strict evaluation in imperative programming languages is not always quite as strict as it seems, and how deviating from strictness can often significantly improve performance.

165
 
 

Brzozowski derivatives are neat, but good old denotational semantics of regular expressions can be very elegant too:

data RE = Empty | Eps | Ch Char | App RE RE | Alt RE RE | Star RE

foldRE :: p -> p -> (Char -> p) -> (p -> p -> p) -> (p -> p -> p) -> (p -> p) -> RE -> p
foldRE emp eps ch app alt star = go where
  go = \case
    Empty -> emp
    Eps -> eps
    Ch c -> ch c
    App p q -> app (go p) (go q)
    Alt p q -> alt (go p) (go q)
    Star p -> star (go p)

recognise :: RE -> String -> [String]
recognise =
  foldRE (pure empty) pure (\c -> \case x : xs | c == x -> [xs]; _ -> [])
    (>=>) (liftA2 (<|>)) (\p -> fix (\t -> liftA2 (<|>) pure (p >=> t)))

#haskell

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

Garbage collection with zero-cost at non-GC time.

167
 
 

Read about the latest GHC development activity in this report from Well-Typed. Highlights include bug fixes and performance improvements.

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

Lenses are not always better:

fresh :: FDState s c -> (Int, FDState s c)
fresh = id &&& id
  >>> first (^. nextId)
  >>> (\(i, s) -> (i, s & alive %~ Set.insert i))
  >>> second (nextId %~ (+ 1))

fresh :: FDState s c -> (Int, FDState s c)
fresh s@FDState {_nextId = i, _alive = as} =
  (i, s {_nextId = i + 1, _alive = Set.insert i as})

#haskell

169
 
 

CLC seeks nominations for a vacant seat. Who should apply? Anyone who meets the following criteria should apply: Candidates should have enough bandwidth to review merge requests to base on a semi-frequent basis (3 to 5 per month), and sustain this for their 3 years term in a healthy manner. Candidates should be able to contribute opinions and analysis to issues raised by the community as a part of the CLC proposal process on a semi-frequent basis (3 to 5 per month). Candidates should be good...

170
 
 

The GHC developers are very pleased to announce the availability of the second 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 more consistent support for non-word-siz...

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

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

172
 
 

The GHC developers are happy to announce the availability of GHC 9.4.6. Binary distributions, source distributions, and documentation are available at downloads.haskell.org. This release is primarily a bugfix release addressing some issues found in 9.4.6.

173
174
175
 
 

Hello, I've written a tool helping me keeping my histfiles free of my secrets. I'd like to hear your thoughts and suggestions about it. I'm a Haskell noob, so please be kind. https://github.com/bionade24/histcleaner

view more: ‹ prev next ›