Skip to content

Instantly share code, notes, and snippets.

Justus Sagemüller leftaroundabout

  • Høgskulen på Vestlandet
  • Bergen
View GitHub Profile
@leftaroundabout
leftaroundabout / Enum.hs
Created Apr 1, 2012 — forked from depp/Enum.hs
Demonstration of how incorrect (Enum x, Enum y) => Enum (x, y) instance can be used for Enum a => Enum (a,a)
View Enum.hs
{-# LANGUAGE FlexibleInstances #-}
-- See http://stackoverflow.com/questions/9967790/instance-in-haskell
instance (Enum a) => Enum (a, a) where
fromEnum (x,y) =
k^2 + 2*j + if permuted then 1 else 0
where
k = max (fromEnum x) (fromEnum y)
j = min (fromEnum x) (fromEnum y)
View ObjIndexedCategory.hs
#!/usr/bin/env stack
{- stack --resolver lts-12.0 runghc -}
{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
{-# LANGUAGE DataKinds, PolyKinds, KindSignatures, TypeInType #-}
{-# LANGUAGE AllowAmbiguousTypes, TypeApplications, GADTs #-}
import Prelude hiding ((.), id)
import qualified Prelude
import Data.Kind
View MoonEscape.hs
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
import Math.LinearMap.Category
import Data.VectorSpace
import Linear.V3
import Data.AffineSpace
import Control.Arrow
import Data.Semigroup
import qualified Diagrams.Prelude as Dia
import Graphics.Dynamic.Plot.R2
View Chord-waveforms.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View diagrams-sizespec.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View MathJax-mathcal.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View braillster.hs
module Main where
import Graphics.Text.PCF
import Data.Foldable (fold)
import System.Environment (getArgs)
main :: IO ()
main = do
args <- getArgs
let style = case ( any (`elem`["-b","--bold"]) args
View LegendreSawtoothGibbs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View CommonFreeComonads.md

Cofree (Const c) ~~ Writer c

Given

data Const c a = Const c

we have

data Cofree (Const c) a
     = a :< Const c
View CommonFreeMonads.md

Free (Const c) ~~ Either c

Given

data Const c a = Const c

we have

data Free (Const c) a
     = Pure a
You can’t perform that action at this time.