This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| combinations :: Int -> [Int] -> [[Int]] | |
| combinations _ [] = [[]] | |
| combinations w (x:xs) | |
| | w >= x = [ x:ys | ys <- combinations (w-x) xs] ++ combinations w xs | |
| | otherwise = combinations w xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Y2022.Day21.Solution where | |
| import CommonParsers (Parser, nameP, numberP, runParser) | |
| import Data.List (nub) | |
| import Data.Map.Lazy (Map) | |
| import qualified Data.Map.Lazy as Map | |
| import qualified Text.Megaparsec as P | |
| import qualified Text.Megaparsec.Char as PC | |
| yearNr :: Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE BangPatterns #-} | |
| -- Description : Advent of Code - 2022 / Tag 19 | |
| -- | |
| -- see [Advent of Code 2022 - day 19](https://adventofcode.com/2022/day/19) | |
| {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} | |
| {-# OPTIONS_GHC -Wno-name-shadowing #-} | |
| module Y2022.Day19.Solution where | |
| import CommonParsers (Parser, numberP, runParser) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace ReaderM | |
| type ReaderM<'d,'out> = | |
| 'd -> 'out | |
| module Reader = | |
| // basic operations | |
| let run dep (rm : ReaderM<_,_>) = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SimpleDep | |
| basic : (b : Bool) -> if b then String else Int | |
| basic True = "it's true" | |
| basic False = 0 | |
| ------------- | |
| data WhatIsIt = AString | AInt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Prelude | |
| import Data.Symbol (class IsSymbol, SProxy(..)) | |
| import Effect (Effect) | |
| import Effect.Console (log) | |
| import Prim.Row as Row | |
| import Prim.RowList (kind RowList, Nil, Cons, class RowToList) | |
| import Record (get) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE RankNTypes, DeriveFunctor #-} | |
| module Riddle where | |
| type T a b c = forall f . Functor f => (a -> f b) -> f c | |
| to :: (a, b -> c) -> T a b c | |
| to (a, b_c) f = fmap b_c (f a) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Data.List (unfoldr) | |
| main = | |
| putStrLn $ "Prüfe Rechnungsnummer 4711: " ++ show (pruefsummeFuerRechnungsNummern 4711) | |
| pruefsummeFuerNetzwerkAdressen = | |
| pruefsumme [5,1] 9 digitsRightToLeft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE TypeInType #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| module VectMap where | |
| import GHC.TypeLits | |
| data Vect (n :: Nat) a where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| cp ~/.local/bin/purescript/v0.12/purs ~/.local/bin/purs | |
| pulp $@ | |
| rm ~/.local/bin/purs | |
| # - still got purs 0.11.7 from npm | |
| # - have current purescript/purs compiled/installed with stack | |
| # - move the version somewhere (I opted into the path above) | |
| # - have .local/bin before your npm installed bins in your PATH |
NewerOlder