This file contains hidden or 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
import cats._ | |
// import cats._ | |
object f1 { | |
trait Fold[I, O] { | |
type M | |
def tally(i: I): M | |
def summarize(m: M): O | |
def monoid: Monoid[M] | |
} | |
object Fold { |
This file contains hidden or 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
library(dplyr) | |
csv <- read.csv("StockX-Data-Contest-2019-3.csv") | |
csv$Sneaker.Name.String <- as.character(csv$Sneaker.Name) | |
csv$Sneaker.Model = as.factor(case_when( | |
startsWith(csv$Sneaker.Name.String, "adidas-Yeezy-Boost-350-V2" ) ~ "Adidas-Yeezy-Boost-350-V2", | |
startsWith(csv$Sneaker.Name.String, "Adidas-Yeezy-Boost-350-V2" ) ~ "Adidas-Yeezy-Boost-350-V2", | |
startsWith(csv$Sneaker.Name.String, "Adidas-Yeezy-Boost-350" ) ~ "Adidas-Yeezy-Boost-350", |
This file contains hidden or 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
library(dplyr) | |
library(plyr) | |
models <- c("Adidas-Yeezy-Boost-350", "Nike-Air-Max-90", "Nike-Air-Presto", "Air-Jordan-1-Retro-High", "Nike-Air-Force-1-Low", "Nike-Air-Max-90", "Nike-Air-Max-97", "Nike-Air-Presto", "Nike-Air-VaporMax", "Nike-Blazer-Mid", "Nike-React-Hyperdunk-2017-Flyknit", "Nike-Zoom-Fly", "Nike-Zoom-Fly-Mercurial", "adidas-Yeezy-Boost-350-V2") | |
csv$Sneaker.Name.String <- as.character(csv$Sneaker.Name) | |
addModel <- function(model) { | |
df <- filter(csv, startsWith(csv$Sneaker.Name.String, model)) | |
df$Sneaker.Model <- model |
This file contains hidden or 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
library(dplyr) | |
library(plyr) | |
models <- c("Adidas-Yeezy-Boost-350", "Nike-Air-Max-90", "Nike-Air-Presto", "Air-Jordan-1-Retro-High", "Nike-Air-Force-1-Low", "Nike-Air-Max-90", "Nike-Air-Max-97", "Nike-Air-Presto", "Nike-Air-VaporMax", "Nike-Blazer-Mid", "Nike-React-Hyperdunk-2017-Flyknit", "Nike-Zoom-Fly", "Nike-Zoom-Fly-Mercurial", "adidas-Yeezy-Boost-350-V2") | |
csv$Sneaker.Name.String <- as.character(csv$Sneaker.Name) | |
addModel <- function(model) { | |
df <- filter(csv, startsWith(csv$Sneaker.Name.String, model)) | |
df$Sneaker.Model <- model |
This file contains hidden or 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
class Uncurry fun types r where | |
uncurryNP :: fun -> NP I types -> r | |
instance forall fun r t types. | |
( Uncurry fun types r | |
) => Uncurry (t -> fun) (t ': types) r where | |
uncurryNP f ((I a) :* as) = uncurryNP (f a) as | |
instance (s ~ r) => Uncurry s '[] r where | |
uncurryNP z Nil = z |
This file contains hidden or 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 --install-ghc | |
--resolver lts-10.8 | |
script | |
--compile | |
--package monad-logger | |
--package katip | |
--package universum | |
--package lens | |
-} |
This file contains hidden or 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 --install-ghc | |
--resolver lts-10.7 | |
script | |
--compile | |
--package katip | |
--package universum | |
--package aeson | |
-} |
This file contains hidden or 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 --install-ghc | |
--resolver lts-10.7 | |
script | |
--compile | |
--package katip | |
--package universum | |
--package aeson | |
-} |
This file contains hidden or 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.1 | |
script | |
--compile | |
--package recursion-schemes | |
-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE TypeSynonymInstances #-} |
This file contains hidden or 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 TypeSynonymInstances #-} | |
import Data.Functor.Foldable | |
newtype Object a = Object {getObject :: a} deriving (Show, Eq, Functor) | |
data Label l a = Label { label :: l, inner :: a } deriving (Show, Eq, Functor) | |
data FooF l a = FooF { nested :: (Label l) (Object a) } | |
type LabelFunctor l = Fix (FooF l) |