home.social

Search

1000 results for “haskell”

  1. Почему я перестал писать bash-скрипты и написал свой язык

    Время от времени мне нужно выполнить примитивный сценарий в терминале, но каждый раз это заканчивается очередным гуглежом «bash iterate each file» или «bash file has string». А что если скрипты в терминале можно было бы писать прямо как поток декларативных мыслей?

    habr.com/ru/articles/1020728/

    #скриптовый_язык #bash #функциональное_программирование #REPL #автоматизация #open_source #Rust #Lisp #Haskell

  2. Почему я перестал писать bash-скрипты и написал свой язык

    Время от времени мне нужно выполнить примитивный сценарий в терминале, но каждый раз это заканчивается очередным гуглежом «bash iterate each file» или «bash file has string». А что если скрипты в терминале можно было бы писать прямо как поток декларативных мыслей?

    habr.com/ru/articles/1020728/

    #скриптовый_язык #bash #функциональное_программирование #REPL #автоматизация #open_source #Rust #Lisp #Haskell

  3. I have a working prototype of an #ASN1 to #Haskell compiler. It can't do a lot yet; but it does translate enum types.

    (Built on top of a lot of great existing work.)

    ```
    ghci> Prelude.putStr =<< Prelude.readFile "./asn1-modules/bar.asn1"
    BarFramework { 1 }

    DEFINITIONS ::=
    BEGIN

    Bar ::= ENUMERATED {red, blue, yellow}

    END -- BarFramework
    ghci> _ = () ; $(spliceFromModuleOrDie "./asn1-modules/bar.asn1")
    ghci> :i Bar
    type Bar :: *
    data Bar = Red | Blue | Yellow
    -- Defined at <interactive>:137:11
    ghci>
    ```

  4. I have a working prototype of an #ASN1 to #Haskell compiler. It can't do a lot yet; but it does translate enum types.

    (Built on top of a lot of great existing work.)

    ```
    ghci> Prelude.putStr =<< Prelude.readFile "./asn1-modules/bar.asn1"
    BarFramework { 1 }

    DEFINITIONS ::=
    BEGIN

    Bar ::= ENUMERATED {red, blue, yellow}

    END -- BarFramework
    ghci> _ = () ; $(spliceFromModuleOrDie "./asn1-modules/bar.asn1")
    ghci> :i Bar
    type Bar :: *
    data Bar = Red | Blue | Yellow
    -- Defined at <interactive>:137:11
    ghci>
    ```

  5. I have a working prototype of an #ASN1 to #Haskell compiler. It can't do a lot yet; but it does translate enum types.

    (Built on top of a lot of great existing work.)

    ```
    ghci> Prelude.putStr =<< Prelude.readFile "./asn1-modules/bar.asn1"
    BarFramework { 1 }

    DEFINITIONS ::=
    BEGIN

    Bar ::= ENUMERATED {red, blue, yellow}

    END -- BarFramework
    ghci> _ = () ; $(spliceFromModuleOrDie "./asn1-modules/bar.asn1")
    ghci> :i Bar
    type Bar :: *
    data Bar = Red | Blue | Yellow
    -- Defined at <interactive>:137:11
    ghci>
    ```

  6. I have a working prototype of an #ASN1 to #Haskell compiler. It can't do a lot yet; but it does translate enum types.

    (Built on top of a lot of great existing work.)

    ```
    ghci> Prelude.putStr =<< Prelude.readFile "./asn1-modules/bar.asn1"
    BarFramework { 1 }

    DEFINITIONS ::=
    BEGIN

    Bar ::= ENUMERATED {red, blue, yellow}

    END -- BarFramework
    ghci> _ = () ; $(spliceFromModuleOrDie "./asn1-modules/bar.asn1")
    ghci> :i Bar
    type Bar :: *
    data Bar = Red | Blue | Yellow
    -- Defined at <interactive>:137:11
    ghci>
    ```

  7. Anyone using the brick #Haskell library and what to shore hints / lecture me about how to test functions that "live in" `EventM` ?

    In particular, I'd like to be able to take an initial state (generated in whole or part randomly) feed some events (mainly keystrokes) in an then validate the final state. But, maybe I'm thinking about it all wrong.

    The rendering functions are "easy enough" to test, but I feel like most of the real "logic" is in the event handling.

    #SoftwareTesting #PropertyTesting

  8. Anyone using the brick #Haskell library and what to shore hints / lecture me about how to test functions that "live in" `EventM` ?

    In particular, I'd like to be able to take an initial state (generated in whole or part randomly) feed some events (mainly keystrokes) in an then validate the final state. But, maybe I'm thinking about it all wrong.

    The rendering functions are "easy enough" to test, but I feel like most of the real "logic" is in the event handling.

    #SoftwareTesting #PropertyTesting

  9. Anyone using the brick library and what to shore hints / lecture me about how to test functions that "live in" `EventM` ?

    In particular, I'd like to be able to take an initial state (generated in whole or part randomly) feed some events (mainly keystrokes) in an then validate the final state. But, maybe I'm thinking about it all wrong.

    The rendering functions are "easy enough" to test, but I feel like most of the real "logic" is in the event handling.

  10. Anyone using the brick #Haskell library and what to shore hints / lecture me about how to test functions that "live in" `EventM` ?

    In particular, I'd like to be able to take an initial state (generated in whole or part randomly) feed some events (mainly keystrokes) in an then validate the final state. But, maybe I'm thinking about it all wrong.

    The rendering functions are "easy enough" to test, but I feel like most of the real "logic" is in the event handling.

    #SoftwareTesting #PropertyTesting

  11. I recently learned about higher kinded data (HKD) using the barbies library. barbies-th adds some helpers to make the usage easier. However I have a hard time understanding how to use the AccessorsB, LensB, getLensB type classes / functions. Can anyone point me to an example?

    #haskell #barbies #hkd #functionalprogramming

  12. Implementation of the Bellman's rule "What I tell you three times is true" (from Lewis Carroll's "The Hunting of the Snark", 1876). The #Haskell code is here: snrk.de/truth-isnt-truth/

    This is a great tool for fact checking.
    This is a great tool for fact checking.
    This is a great tool for fact checking.

    #TheHuntingOfTheSnark, #LewisCarroll, #WhatITellYouThreeTimesIsTrue, #BellmansRule, #thrice, #threeTimes, #truth, #facts, #assertion, #assertiveness, #proof, #FactChecking

  13. Context free grammars (CFG) are better than parsing expression grammars (PEG), because CFGs represent how we think.

    Parser combinators are similar to PEGs, so they are worse than CFGs, too.

    So, don't use Rust libraries nom, combine. Use lalrpop.

    Don't use Haskell libraries parsec, gigaparsec, attoparsec, megaparsec, trifecta. Use Earley, happy.

    See more detailed story in my new article safinaskar.writeas.com/this-is .

    The story also includes some cases, where PEG and parser combinators may still be useful. Also, the article gives links to my Haskell parsing libraries.

    #haskell #rust #parsing #parse #cfg #peg #combinators #parsercombinators #parsingcombinators #nom #combine #lalrpop #parsec #earley #happy

  14. The folks at #Kattis finally published the problems from a bunch of old #competitiveprogramming contests that they have hosted over the years, including quite a few that I helped organize. Yay! (I have been bugging them to do this literally for years.) In particular, the list of available problems written by me instantly went from 2 to about 35:

    open.kattis.com/problem-author

    I have solved many (though not all) of them in #Haskell. Give them a try and let me know what you think! 😄

  15. Funxy — гибридный язык программирования со статической типизацией

    Funxy — гибридный язык программирования со статической типизацией, pattern matching и удобной работой с бинарными данными. Для чего подходит Скрипты и автоматизация. Один бинарник без зависимостей — скачал и работает. Встроенная работа с файлами, JSON, HTTP, SQL. Небольшие приложения. CLI-утилиты, API-сервисы, обработка данных. Работа с бинарными данными. Парсинг на уровне отдельных битов. Сетевые протоколы, форматы файлов, нестандартные структуры. Обучение программированию. Простой синтаксис, но с важными концепциями: типы, pattern matching, иммутабельные структуры данных, рекурсия с TCO (можно писать рекурсивный код без страха переполнения стека).

    habr.com/ru/articles/974674/

    #haskell #monad #tco #скриптовый_язык #разработка_языков_программирования #функциональное_программирование #рекурсия #matching #bitstring #http

  16. Parser combinators in #Haskell are like the cool kids at school 🎓, effortlessly solving Advent of Code problems while #regexes are stuck in detention 🚫. Who knew regexes were still a thing in 2025? 😂 In Haskell, we leave those relics to flounder in the past while we flex our combinator muscles 💪.
    entropicthoughts.com/parser-co #ParserCombinators #AdventOfCode #FutureCoding #Flexibility #HackerNews #ngated

  17. I just published a post on an interesting MSc thesis I supervised. Arvid Rydberg and Selina Sand Engberg took on the computational challenge of level-p-complexity (D_p(f)) of Boolean functions.

    They optimised the algorithms using hash-consing & normalisation, and developed tools for exact calculations using algebraic numbers.

    Details:
    patrikja.owlstown.net/posts/45

    #Haskell #CompSci #BooleanLogic

    I presented earlier work (from before this MSc thesis) at ICFP 2024: youtube.com/watch?v=mxDjPTDwbGE

  18. 🧙‍♂️✨Welcome to the magical world where #Haskell and #Swift somehow "talk," all wrapped up in a shiny #XCFramework package!📦🔧 Follow this riveting tale of dependency hell, where tech wizards tackle marshalling and the foreign function interface—because who needs simple, right? 😂🌀
    alt-romes.github.io/posts/2025 #DependencyHell #TechWizards #HackerNews #ngated

  19. Error messages should be independent. If you solve the underlying issue of one, it should not also solve another error message. Reporting multiple errors with the same underlying cause will just overload your users.

    I think that's what's happening here: stackoverflow.com/q/79816819/1. You can solve 4/5 errors by just adding an extra argument to the `foldr` call.

    #haskell #errormessages #usability

  20. #Haskell #opinion #poll:

    Check all that you consider functions in Haskell. (The question is not whether you believe these exist in Haskell (all 4 do), but rather which ones (according to your opinion / your terminology use) are to be considered to be "functions".)

    #functionalProgramming #opinionPoll #concept #mentalModel

  21. 🍕💻 Ah yes, the existential crisis of programming languages: do you need to understand #Haskell to grasp their 'lil' quirks, or can you just wing it with your pancreas? 🙃 Spoiler: It's all the same lexing, parsing, and desugaring nonsense, just with a sprinkle of pretentiousness to make you feel like you're doing something revolutionary. 🚀
    taylor.town/scrapscript-001 #programminglanguages #existentialcrisis #codinghumor #techsatire #lexingparsing #HackerNews #ngated

  22. Any other #haskell devs out there doing #rustlang in the meantime?

    I use it for 1y now in day job (and toy projs as well).

    #frunk , #typenum , #uom crates helped me a lot to get a "better feel" for the type system, f.e. implementing type functions (aka families) with traits+assoc types.

    But still often in the situation where in #haskell land i'd blindly grab into toolbox and grab f.e. a GADT + a tranformer stack, where in #rustlang I am sometimes struggle "how to" in #rustlang type-system.

  23. CW: :haskell:, конструкція where

    Окрім виразу let in є ще схожа конструкція where. Вона виконує ту ж функцію, але трохи по інакшому.

    g n = x+2*x where x = n^3+2
    

    На перший погляд, змінилась тільки послідовність оголошення та використання функцій, і це майже правильно. Ключова відмінність у, тому що let in це вираз, а where конструкція. Тому друге можна використовувати там де не можна перше, наприклад при використанні кількох визначень з охоронними виразами чи зіставленнями.

    f x | x > 0 = y * 2
        | x < 0 = y / 2
      where y = cos x^2
    

    На жаль приклад дуже не дуже, але є що є.

    Тут оголошені функції після whare можна використовувати в усіх визначеннях f, й навіть в охоронних виразах. let in такого не дозволяє.

    #ukrhaskell #haskell #where #letin #вираз #конструкція #підфункції #охоронні_вирази #програмування