Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Created March 28, 2014 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puffnfresh/9824390 to your computer and use it in GitHub Desktop.
Save puffnfresh/9824390 to your computer and use it in GitHub Desktop.
x :: Int
x = 100
hello :: String
hello = "Hello world"
shorter = "Hello world"
f :: Int -> Int
f n = n + 10
g :: Int -> Int
g = (\n -> n + 10)
ten :: Int
ten = f 0
-- Test
{-
{-
Hello
-}
-}
eleven :: Int
eleven = ((+) 10) 1
addOne :: Int -> Int
addOne = (+) 1
infixl 9 ^&^
(^&^) :: Int -> Int -> Int
(^&^) = (+)
-- a -> (a -> a)
data Person = Person String String deriving Show
data Booleane = Truee | Falsee
data Maybee a = Juste a | Nothinge deriving Show
something :: Maybee Int
something = Juste 10
nothing :: Maybee Int
nothing = Nothinge
y :: Maybee Int -> Int
y m = case m of
Juste n -> n + 1
Nothinge -> 0
h :: IO ()
h = print (let n = 10 in n * n)
j :: Maybee Int -> IO ()
j m
| x < 100 = print x
| otherwise = putStrLn "Bub"
where x = case m of
Juste n -> n + 1
Nothinge -> 0
class Appendable a where
append :: a -> a -> a
instance Appendable Int where
append a b = a + b
instance Appendable Bool where
append a b = a && b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment