Skip to content

Instantly share code, notes, and snippets.

View hhefesto's full-sized avatar

Daniel Herrera Rendón hhefesto

View GitHub Profile
@hhefesto
hhefesto / tutorial.md
Last active October 14, 2024 19:03
Haskell Tutorial: Validity, GenValid, Recursion Schemes, and Testing with Tasty

Haskell Tutorial: Validity, GenValid, Recursion Schemes, and Testing with Tasty

This tutorial demonstrates using the validity and genvalidity packages along with recursion schemes and both property-based and unit testing using tasty-quickcheck and tasty-hunit for a simple arithmetic expression evaluator.

Setup

First, let's update our project structure:

validity-tutorial/
module Telomare.Cesar where
import Data.Char (ord, chr, isLetter, isLower)
import Text.Read (Lexeme(Char))
input = unlines $ [ "11"
, "middle-Outz"
, "2"
]
@hhefesto
hhefesto / error.hs
Created May 23, 2022 15:06
hls debug error
╭─hhefesto@olimpo ~/src/telomare ‹master●›
╰─$ haskell-language-server --debug src/Telomare.hs ghc-shell-for-telomare-0.1.0.0
2022-05-23T15:03:34.362602Z | Info | No log file specified; using stderr.
2022-05-23T15:03:34.362939Z | Info | haskell-language-server version: 1.7.0.0 (GHC: 9.2.2) (PATH: /nix/store/6svi1lnknjygjl6qsfckxvv4iizi0rn0-haskell-language-server-1.7.0.0/bin/haskell-language-server)
2022-05-23T15:03:34.363348Z | Info | Directory: /home/hhefesto/src/telomare
2022-05-23T15:03:34.363506Z | Info | Logging heap statistics every 60.00s
ghcide setup tester in /home/hhefesto/src/telomare.
Report bugs at https://github.com/haskell/haskell-language-server/issues
Step 1/4: Finding files to test in /home/hhefesto/src/telomare
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@hhefesto
hhefesto / diff
Created March 4, 2022 18:44
039312d and HEAD~1
diff --git a/Prelude.tel b/Prelude.tel
index 555aa9f..8908c75 100644
--- a/Prelude.tel
+++ b/Prelude.tel
@@ -89,3 +89,6 @@ quicksort = let layer = \recur l -> if right l
in listPlus (recur p2) (t,(recur p1))
else l
in ? layer (\l -> 0)
+
+abort = \str -> let x : (\y -> listPlus "abort: " str) = 1
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"solanaNix",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
@hhefesto
hhefesto / default.nix
Created September 21, 2020 16:06
overlay not working
let
gcOverlay = self: super: {
# jumper = telomare_jumper;
gc = self.boehmgc;
};
in
{ # Fetch the latest haskell.nix and import its default.nix
# haskellNix ? import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/dc7acfeb7628032d5109747a8b330d58817b953f.tar.gz") {}
haskellNix ? import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") { overlays = [ gcOverlay ]; }
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Daniel Herrera Rendón")
(setq user-mail-address "[email protected]")
{ rev1 ? "78d05675a4186c3b7b2de214f3c3b245ba0d2fa5",
# rev ? "1a92d0abfcdbafc5c6e2fdc24abf2cc5e011ad5a",
outputSha256 ? "0aam50m1w1kqfdhwnazzi6jdq422d3ib3ilvb1m5lcr5jn7nhf1f",
# enableLLVMAssertions ? true
enableLLVMAssertions ? false
}:
with rec {
nixpkgs = (import <nixpkgs> { }).fetchFromGitHub {
# a = true;
{
laurus = {pkgs, ...}:{
networking.firewall.allowedTCPPorts = [ 22 80 5432 587 443 ];
nixpkgs.config = import ~/src/laurus-nobilis/config.nix;
systemd.services.laurus-nobilis =
{ description = "laurus-nobilis";
enable = true;
wantedBy = [ "multi-user.target" "nginx.service" ];