Skip to content

Instantly share code, notes, and snippets.

@tonyday567
tonyday567 / .travis.yml
Created Dec 12, 2018
A multi-ghc/cabal/stack haskell travis
View .travis.yml
language: haskell
dist: trusty
cache:
directories:
- $HOME/.cabal/packages
- $HOME/.cabal/store
- $HOME/.stack
- $TRAVIS_BUILD_DIR/.stack-work
View basics.hs
#!/usr/bin/env stack
-- stack --install-ghc runghc --resolver nightly-2018-08-17 -- -Wall -O2
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DerivingVia #-}
View Backprop.hs
#!/usr/bin/env stack
-- stack --install-ghc runghc --resolver lts-11.9 --package backprop-0.2.2.0 --package numhask-prelude-0.0.4.1 --package numhask-0.2.1.0 -- -Wall -O2
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}
View existensial-slice-hack.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
View SingNotes.hs
{-# language DataKinds, PolyKinds, ScopedTypeVariables, UndecidableInstances,
FlexibleInstances, FlexibleContexts, GADTs, TypeFamilies, RankNTypes,
LambdaCase, TypeOperators, ConstraintKinds #-}
import GHC.TypeLits
import Data.Proxy
import Data.Singletons.Prelude
import Data.Singletons.Decide
import Data.Constraint
View Getter.hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
module Pipes.Getter where
View TestMVC.hs
{-# language OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module TestMVC where
import Control.Category hiding ((.),id)
import qualified MVC.Prelude as MVC
import MVC
import qualified Pipes.Prelude as Pipes
import Control.Applicative
View TestMVC.hs
vcStd :: Managed (View C.ByteString, Controller C.ByteString)
vcStd = ((,) <$> pure (contramap show MVC.stdoutLines) <*> fmap C.pack <$> MVC.stdinLines)
View core-cloud.hs
tRemote :: Int -> IO ()
tRemote n = do
backend0 <- initializeBackend host portSlave rtable
node0 <- newLocalNode backend0
backend <- initializeBackend host portMaster rtable
node <- newLocalNode backend
Node.runProcess node (remotePipe' n (Node.localNodeId node0))
where
rtable :: RemoteTable
rtable = __remoteTable initRemoteTable
View json.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DefaultSignatures #-}
import GHC.Generics
import Control.Applicative
import Data.Text.Encoding
import Data.Aeson
import Data.Aeson.Types
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB