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
| var findByTitle: (String) -> (MutableList<Movie>) -> List<Movie> = | |
| { query -> { collection -> | |
| val predicate = matches(query) | |
| filter(predicate)(collection) | |
| }} | |
| val filter: ((Movie) -> Boolean) -> (List<Movie>) -> List<Movie> = | |
| { predicate -> { collection -> | |
| collection.filter(predicate) | |
| }} |
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
| var findByTitle: (String) -> (MutableList<Movie>) -> List<Movie> = | |
| { query -> { collection -> | |
| val predicate = matches(query) | |
| filter(predicate)(collection) | |
| }} | |
| val filter: ((Movie) -> Boolean) -> (List<Movie>) -> List<Movie> = | |
| { predicate -> { collection -> | |
| collection.filter(predicate) | |
| }} |
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
| gcdHaskell :: Int -> Int -> Int | |
| gcdHaskell x y | x > y = gcdHaskell (x - y) y | |
| | x < y = gcdHaskell x (y - x) | |
| | otherwise = x | |
| main = print $ gcdHaskell 4 2 |
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
| module TicTacToe | |
| import Data.Vect | |
| data Piece = X | O | N | |
| next : Piece -> Piece | |
| next X = O | |
| next O = X | |
| next N = N |
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
| module TicTacToe | |
| import Data.Vect | |
| ||| All possible player pieces, where N represents empty | |
| data Piece = X | O | N | |
| ||| Select next player | |
| next : Piece -> Piece | |
| next X = O |
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
| module TicTacToe | |
| import Data.Vect | |
| ||| All possible player pieces, where N represents empty | |
| data Piece = X | O | N | |
| ||| Select next player | |
| next : Piece -> Piece | |
| next X = O |
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 Data.List | |
| compose :: [a -> a] -> a -> a | |
| compose fs v = foldl' (flip (.)) id fs $ v |
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 Data.List | |
| compose :: [Maybe (a -> a)] -> a -> a | |
| compose fs v = foldl' compf id fs $ v | |
| compf :: (a -> a) -> Maybe (a -> a) -> (a -> a) | |
| compf f mg = | |
| case mg of | |
| Nothing -> f | |
| Just g -> g . f |
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-7.14 --install-ghc runghc --package vty --package pipes --package pipes-concurrency | |
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import Graphics.Vty | |
| import Data.Default | |
| import Control.Monad | |
| import System.IO |
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
| package intellij.haskell.external.repl | |
| import java.io._ | |
| import java.util.concurrent.{ConcurrentLinkedDeque, SynchronousQueue} | |
| import com.intellij.util.EnvironmentUtil | |
| import scala.collection.JavaConverters._ | |
| import scala.collection.mutable.{ArrayBuffer, ListBuffer} | |
| import scala.io._ |