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 OverloadedStrings #-} | |
module Main where | |
import System.Exit | |
import System.IO | |
import Data.Char | |
import Database.SQLite.Simple | |
import Text.RawString.QQ | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import Database.SQLite.Simple.Types |
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
-- For [p_1,p_2 ... p_n] | |
-- Find three indices i, j and k such that: | |
-- 1 ≤ i < j < k ≤ n; | |
-- p_i < p_j and p_j > p_k. | |
-- Or say that there are no such indices. | |
func :: S.Seq Int -> String | |
func sq = let (a,b,c,suc) = S.foldrWithIndex (\ind a (i, j, k, b) -> | |
case b of | |
0 -> |
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 ScopedTypeVariables #-} | |
module Main where | |
import System.IO | |
import System.Random | |
import Data.Char | |
import Text.Read | |
import Control.Monad.IO.Class | |
import Control.Monad | |
import Data.Maybe | |
import Control.Monad.Trans.State as S |
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 Main where | |
import Control.Monad.Trans.State | |
import Data.Functor.Identity | |
type PScore = Int | |
type CScore = Int | |
type GameState = (PScore, CScore) | |
valFromGameState :: GameState -> (Int, Int) | |
valFromGameState = id |
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 Phone where | |
import Text.Trifecta | |
import Control.Applicative | |
import Data.Char | |
type NumberingPlanArea = Int | |
type Exchange = Int | |
type LineNumber = Int |
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 SemVer3 where | |
import Control.Applicative | |
import Control.Monad | |
import Data.Char | |
import Text.Trifecta | |
import Data.List.NonEmpty (NonEmpty(..), fromList) | |
type Letter = Char | |
-- parseLetter :: Parser Letter |
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
f1 = (<$> ((:[]) <$>)) | |
f1 :: (Functor f) => (f [a] -> b) -> f a -> b | |
:: (Functor f) => (f [a] -> b) -> (f a -> b) | |
(=<<) :: (Monad m) => (a -> m b) -> m a -> m b | |
:: (Monad m) => (a -> m b) -> (m a -> m b) | |
-- Applying f1 to (=<<) | |
f = f1 (=<<) | |
f :: (a -> b) -> [a] -> [b] | |
:: (a -> b) -> ([a] -> [b]) | |
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 Main where | |
import Data.Char | |
main :: IO () | |
main = do | |
lf <- getLine | |
ls <- getLine | |
let m = (words lf) !! 0 | |
let n = (words lf) !! 1 | |
let r = (words lf) !! 2 | |
let m1 = (words ls) !! 0 |
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 Main where | |
main :: IO () | |
main = do | |
guessI <- getLine | |
if (read guessI /= 0) then | |
oneGame True (read guessI) (1, 10) | |
else | |
return () |
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 String where | |
import Data.List | |
notThe :: String -> Maybe String | |
notThe = wrapper . unwords . filter (\x -> x /="the" && x /="The") . words | |
notThe' :: String -> String | |
notThe' l@(x0:x1:x2:x3:x4) = case (x0) of | |
' ' -> case (x4) of | |
(' ':_) -> case (x1:x2:x3:[]) of |
NewerOlder