$ brew install openssl libssh
$ export LIBRARY_PATH=/usr/local/lib OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include
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
module Main (main) where | |
import Control.Monad (forM_) | |
-- | Given the length l of a cord from points A to B on the unit circle, compute | |
-- the length of the cords A-C and C-B, where C is the point on the unit circle | |
-- exactly in between A and B. | |
iterArchimedes :: Double -> Double | |
iterArchimedes l = l / sqrt (2 + sqrt (4 - l*l)) |
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
Copyright Tim Baumann (c) 2016 | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. |
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
pijul.org | |
sanakirja |
Nachtrag zum [FTypes-Vortrag beim Curry Club Augsburg][youtube]:
Ich habe gezeigt, wie man mit FTypes einen bidirektionalen JSON-Parser für den Datentyp FGithubUser Identity
schreiben kann. Nun ist das ja ein etwas unhandlicher Record-Datentyp, weil alle seine Feld-Werte noch mit dem Identity
-Funktor gewrappt sind. Deshalb will man auch noch einen "ganz normalen" Datentyp
data GithubUser
= GithubUser
{ userLogin :: T.Text
, userId :: GithubUserId
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 ExplicitForAll #-} | |
module WorksOnlyWithoutScopedTypeVariables where | |
myMap :: forall a b. (a -> b) -> [a] -> [b] | |
myMap = myMapWithSwappedVariables | |
where | |
myMapWithSwappedVariables :: (b -> a) -> [b] -> [a] | |
myMapWithSwappedVariables = fmap | |
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-6.4 --install-ghc runghc --package primitive --package hashable --package vector | |
module HashTable where | |
import Prelude hiding (lookup) | |
import Control.Monad.Primitive (PrimMonad (..)) | |
import Data.Hashable (Hashable (..)) | |
import qualified Data.List as L | |
import qualified Data.Vector.Mutable as VM |
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-6.4 --install-ghc runghc --package unordered-containers --package QuickCheck --package hashable | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module DiffMonoid where | |
import Data.Hashable (Hashable) | |
import Data.Monoid ((<>)) | |
import Test.QuickCheck |
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 FlexibleInstances #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE ViewPatterns #-} |
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
module PatternSynonymsImport where | |
-- one can use either an unqualified import | |
import PatternSynonymsTest | |
-- alternatively one can use explicit imports (this requires enabling the | |
-- PatternSynonyms language extension): | |
-- import PatternSynonymsTest (Option(..), pattern None) | |
maybeToOption :: Maybe a -> Option a | |
maybeToOption Nothing = None |