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 runhaskell -Wall | |
import Control.Concurrent (threadDelay, forkIO) | |
import Control.Concurrent.MVar | |
import Control.Monad (liftM, filterM) | |
import Data.List (isPrefixOf, (\\)) | |
import HSH.ShellEquivs (glob) | |
import System.Directory (canonicalizePath, getCurrentDirectory, doesFileExist) | |
--import System.Environment (getArgs) | |
import System.FilePath ((</>)) |
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 Rank2Types #-} | |
-- This is a small example of where you need to use Rank2Types (or | |
-- RankNTypes). | |
-- The 'a' type is being used polymorphically here, but when it | |
-- is called, it will already be bound (as either an Int or String), | |
-- so it cannot be used polymorphically. | |
-- |
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 ScopedTypeVariables #-} | |
-- | This is an explanation of a combination function written in Haskell | |
-- from http://rosettacode.org/wiki/Combinations#Dynamic_Programming_2 | |
module Main where | |
-- | Adds a @a@ to the beginning of every list inside the list of lists. | |
-- However, if the list of lists is just an empty list, return an empty | |
-- list. |
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
dist | |
cabal-dev | |
*.o | |
*.hi | |
*.chi | |
*.chs.h | |
*.dyn_o | |
*.dyn_hi | |
.hpc | |
.hsenv |
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=nightly-2015-07-08 runghc --package=shelly | |
-- The ExtendedDefaultRules extension gives us an experience similar to | |
-- @ghci@. Raw values (1 and 10 below) that implement the 'Num' type | |
-- class will be defaulted to 'Int' (specified with the @default@ | |
-- command below). Raw values (all strings) that implement the | |
-- 'IsString' typeclass will be defaulted to Text (also specified | |
-- with the @default@ command below). | |
-- |
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-9.0 script --package transformers --package lens -- -Wall | |
-- If you have stack installed, all you need to do is make this file executable | |
-- and you can run it from the command line. | |
module Main where | |
import Control.Lens (Prism', Traversal', _1, _2, preview, prism', set) |
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 DeriveFunctor #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Main where | |
import Data.Functor.Identity (Identity(Identity, runIdentity)) | |
type Lens s a = forall f. Functor f => (a -> f a) -> s -> f s | |
data UserName = UserName { first :: String, second :: String } deriving Show |
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 GADTs #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
------------------------------------------------------ | |
-- This is a gist for the stackoverflow question | |
-- https://stackoverflow.com/questions/45884762/non-lawful-monoid-instances-for-building-up-ast-considered-not-harmful-in-haskel | |
------------------------------------------------------ |
OlderNewer