This file contains 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
#!/usr/bin/env stack | |
-- stack --resolver lts-12.18 script | |
import Control.Concurrent (threadDelay) | |
import Control.Concurrent.Async (replicateConcurrently_) | |
import Control.Monad (unless) | |
import Data.IORef | |
import System.Random (randomIO) | |
main :: IO () | |
main = do |
This file contains 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
{ nixpkgs ? <nixpkgs> | |
, includeBroken ? true | |
}: | |
# Results in all haskell packages that are instantiatable and are executables | |
# Buildable via `nix-build haskell-exes.nix` | |
let | |
pkgs = import nixpkgs { | |
config = { | |
allowBroken = includeBroken; |
This file contains 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
--- README.configure | |
+++ README.configure | |
@@ -9,8 +9,8 @@ CONFIGURE OPTIONS | |
--enable-everything | |
Add (or remove) support for all non-multichoice options listed in | |
- "./configure --help", except for "--enable-assert" and | |
- "--enable-256-color". | |
+ "./configure --help", except for "--enable-assert", | |
+ "--enable-256-color" and "--enable-24-bit-color". |
This file contains 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 OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main (main) where | |
import Colonnade (Headed) | |
import Data.ByteString (ByteString) | |
import Data.Map (Map) | |
import Data.Text (Text) | |
import Siphon (Siphon, SiphonError) |
This file contains 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
-- in response to https://www.reddit.com/r/haskell/comments/a50xpr/datahaskell_solve_this_small_problem_to_fill_some/ | |
{-# LANGUAGE BangPatterns, OverloadedStrings, RecordWildCards, ScopedTypeVariables #-} | |
module Main where | |
import Control.Category ((>>>)) | |
import Data.Function ((&)) | |
import Data.Map.Strict (Map, (!)) | |
import Data.Set (Set) | |
import Test.DocTest (doctest) |
This file contains 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
#!/data/data/com.termux/files/usr/bin/zsh | |
# | |
# This is a termux-url-opener script to do diffrent tasks on my Android phone | |
# | |
url=$1 | |
echo "What should I do with $url ?" | |
echo "y) download youtube video to movies-folder" | |
echo "u) download youtube video and convert it to mp3 (music-folder)" | |
echo "s) download with scdl (soundcloud)" |
This file contains 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 ConstraintKinds #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE PartialTypeSignatures #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} |
This file contains 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
import uuid | |
import json | |
# Returns a python dictionary given a file containing a JSON-based | |
# component definition. Every definition *must* contain a 'type' | |
# and 'schema' field inside a top-level dictionary. Here is an | |
# example of a simple schema file that defines a 'meta' component | |
# containing a 'name' field. | |
# |
This file contains 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
newtype MonoidComp r m a = MonoidComp { unMonoidComp :: ContT r m a } | |
deriving (Functor, Applicative, Monad, MonadTrans) | |
instance (Applicative m, Monoid r) => Alternative (MonoidComp r m) where | |
empty = MonoidComp $ ContT $ const (pure mempty) | |
MonoidComp a <|> MonoidComp b = | |
MonoidComp $ ContT $ \f -> liftA2 (<>) (runContT a f) (runContT b f) | |
foldMapA :: (Foldable f, Applicative m, Monoid r) => (a -> m r) -> f a -> m r | |
foldMapA f = foldr (liftA2 (<>) . f) (pure mempty) |
This file contains 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
#! /usr/bin/env nix-shell | |
#! nix-shell -I nixpkgs=channel:nixos-18.09 -i ghci -p "haskellPackages.ghcWithPackages (p: [p.monoidal-containers p.average])" | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MonadComprehensions #-} | |
import Control.Applicative ( Alternative(..) ) | |
import Control.Monad.Trans.Cont | |
import Data.Map.Monoidal ( MonoidalMap ) | |
import qualified Data.Map.Monoidal as Map |