Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE GHC2021 #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LexicalNegation #-}
{-# LANGUAGE LambdaCase, MultiWayIf #-}
{-# LANGUAGE NPlusKPatterns #-}
{-# LANGUAGE DataKinds, PolyKinds, NoStarIsType, TypeFamilyDependencies #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedRecordDot, NoFieldSelectors, DuplicateRecordFields #-}
module Main where
{-# LANGUAGE GHC2021 #-}
module Main where
import Data.Char
import System.Environment
import System.Random.Shuffle
main :: IO ()
main = do
{ args <- getArgs
module BorderedMatrix where
import Data.Array
import Data.List
{- |
>>> mapM_ print sample
[1,2,3]
[4,5,6]
>>> mapM_ print (borderedMatrix 0 sample)
{-# LANGUAGE GHC2021 #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LexicalNegation #-}
{-# LANGUAGE LambdaCase, MultiWayIf #-}
{-# LANGUAGE NPlusKPatterns #-}
{-# LANGUAGE NoStarIsType, TypeFamilyDependencies, TypeInType #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedRecordDot, NoFieldSelectors, DuplicateRecordFields #-}
module Main where
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
.stack-work/
dist-new/
dist-newstyle/
misc.cabal
*.log
core
*.hi
*.o
*~
module Main where
import System.Environment
import System.IO
main :: IO ()
main = do
{ putStrLn =<< getProgName
; putStr "stdin : "; print =<< hGetBuffering stdin
; putStr "stdout: "; print =<< hGetBuffering stdout
module Numeronym where
import Control.Arrow ( Arrow((&&&)) )
import Data.Char ( isAscii, isLower )
import Data.Function ( on )
import Data.List ( groupBy, isSuffixOf, sortBy )
import Data.Ord ( comparing )
numeronym :: String -> String
numeronym s = take 1 s ++ show n ++ drop (n+1) s
module CountInversion where
import Control.Arrow
type Count = Int
type Size = Int
{- |
>>> countInversion [19,11,10,7,8,9,17,18,20,4,3,15,16,1,5,14,6,2,13,12]
114
-}
{-# LANGUAGE GHC2021 #-}
module Main where
import Data.Char ( isDigit )
import Data.Maybe ( mapMaybe )
main :: IO ()
main = interact (drive repl)
drive :: ([String] -> [String]) -> (String -> String)