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 | |
true :: a -> b -> a | |
true x _ = x | |
false :: a -> b -> b | |
false _ x = x | |
iF :: (a -> a -> a) -> a -> a -> a | |
iF b x y = b x y |
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 | |
fizzbuzz :: Int -> String | |
fizzbuzz i | |
| i `mod` 15 == 0 = "FizzBuzz" | |
| i `mod` 3 == 0 = "Fizz" | |
| i `mod` 5 == 0 = "Buzz" | |
| otherwise = show i |
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 Cards | |
( Suit(..) | |
, Card | |
, allCards | |
, cardSuit | |
, cardNumber | |
, cardStrength | |
) where | |
data Suit = Hearts | Diamonds | Clubs | Spades |
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 TemplateHaskell#-} | |
module Main where | |
import Language.Haskell.TH | |
$( do | |
location >>= runIO . (\loc -> do | |
putStrLn $ loc_filename loc -- THの書かれたファイル名 | |
putStrLn $ loc_package loc -- パッケージ名 | |
putStrLn $ loc_module loc -- モジュール名 | |
print $ loc_start loc -- ソースコード上のマクロの開始位置(行, 列) |
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 Prelude hiding ((.), id) | |
import Control.Category | |
import Control.Applicative | |
--------- | |
-- Test | |
main :: IO () | |
main = do |
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 TemplateHaskell #-} | |
module Main where | |
import Control.Lens | |
data Foo a b = Hoge a | Piyo b | Fuga String | |
deriving (Show, Read, Eq, Ord) | |
makePrisms ''Foo | |
----- |
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 RankNTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE LambdaCase #-} | |
module Main where | |
import Unsafe.Coerce | |
import Control.Applicative (Applicative(..), WrappedMonad(..)) | |
import Control.Monad | |
import Control.Monad.Reader |
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 RankNTypes #-} | |
module Main where | |
import Unsafe.Coerce | |
import Control.Applicative | |
import Control.Category (Category) | |
import Control.Lens | |
import Control.Monad.Identity | |
import Data.Either | |
import Data.Monoid | |
import Numeric.Natural |
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 GADTs #-} | |
module Main where | |
import Control.Object | |
import Control.Monad.Operational | |
import Control.Monad.Trans.State.Strict | |
import Control.Monad.IO.Class | |
import Control.Monad | |
main :: IO () | |
main = do |
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 RankNTypes #-} | |
{-# LANGUAGE GADTs #-} | |
module Main where | |
import Control.Applicative | |
import Control.Monad.Identity | |
import Control.Monad.State | |
import Control.Concurrent.MVar | |
import Control.Monad.Operational | |
-------- |