- What's a recipe?
- What's a target?
- What's a rule?
- What's that `.PHONY` thing? What's that `.DEFAULT_GOAL` thing?
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 FlexibleInstances #-} | |
{-# LANGUAGE PartialTypeSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# OPTIONS_GHC -Wno-partial-type-signatures #-} | |
module ZipWith where | |
import Control.Applicative (ZipList (..)) | |
import Prelude hiding (zipWith) |
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 BangPatterns #-} | |
module LazyLength ( | |
LazyLength(), | |
fromLazyLength, | |
toLazyLength, | |
lazyLength, | |
-- QuickCheck properties | |
prop_invariant, | |
prop_invertible, | |
prop_addition, |
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 ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# OPTIONS_GHC -Wall -Wextra -Werror -Wno-name-shadowing -Wno-unused-top-binds #-} | |
module Lib | |
( shortestLongest, | |
) | |
where |
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 BlockArguments #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# OPTIONS_GHC -Wall -Werror -Wextra #-} | |
module Hyperfunction where | |
import Control.Category | |
import Data.Function (fix) | |
import Prelude hiding (id, (.)) |
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
extern crate structopt; | |
use clap::ArgGroup; | |
use structopt::StructOpt; | |
#[derive(Debug, StructOpt, PartialEq)] | |
#[structopt(group(ArgGroup::with_name("confs").multiple(true)))] | |
pub struct Command { | |
#[structopt(long = "config", group = "confs", parse(from_str = config))] | |
configs: Vec<Conf>, |
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
// ==UserScript== | |
// @name NewScientistViewer | |
// @namespace http://rampion.myopenid.com | |
// @description (U) Hide "You have now viewed your 3 free articles" popover from New Scientist. | |
// @include http://www.newscientist.com/article/* | |
// ==/UserScript== | |
// inject script, so hide overlay can use the has library, and runs after the popover happens. | |
const script = document.createElement('script'); | |
script.type = "text/javascript"; |
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 #-} | |
{-# LANGUAGE TypeApplications #-} | |
module SortAsReverse where | |
-- challenge from bindthegap.news issue 1, Nov 2020 | |
-- | |
-- implement reverse using sort | |
import Data.Coerce (coerce) |
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
{-# OPTIONS_GHC -Wno-name-shadowing #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DeriveFoldable #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} |
So we're given the task of determining whether a given integer is a palindrome in base 10.
Seems easy enough:
isPalindrome :: Integer -> Bool
isPalindrome n = show n == reverse (show n)
Done. That was a short article.