This file contains 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 DeriveGeneric #-} | |
module Main where | |
import Control.DeepSeq | |
import Control.DeepSeq.Generics (genericRnf) | |
import GHC.Generics | |
data List a = Nil | Cons a (List a) deriving (Generic) |
This file contains 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
data Point2D = Point2D { x :: Double, y :: Double } | |
p = Point2D { x = 1 } | |
-- Point2D (D# 1.0) (recConError "x.hs:3:5-21|y"#) | |
main = do | |
print (x p) | |
print (y p) -- BOOM |
This file contains 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 ( | |
iterate, repeat, map, filter, zipWith, zip, | |
take, takeWhile, drop, dropWhile) | |
import qualified Prelude as P | |
import Text.Printf (printf) | |
import Data.List (intercalate) | |
infixr 5 :> |
This file contains 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.Char (ord) | |
main = print $ rot13 "unccl oveguqnl, funqra!" | |
where | |
rot13 = foldr replace [] | |
alpha = ['a'..'z'] | |
index x = (ord x - ord 'a' + 13) `mod` 26 | |
replace x xs | |
| x `elem` alpha = alpha !! index x:xs | |
| otherwise = x:xs |
NewerOlder