Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Haskell Bound int type

main = do 
   print (maxBound :: Int) 
   print (minBound :: Int) 

Haskell Enum type class

main = print (succ 12) 

Haskell Read Interface

main = print (readInt "12") 
readInt :: String -> Int 
readInt = read 

Haskell Show type class

main = print (show [1..10]) 

Haskell Ord type class

main = print (4 <= 2) 

Haskell EQ type class

main = do 
   if 8 /= 8 
      then putStrLn "The values are Equal" 
   else putStrLn "The values are not Equal"

Haskell Char type class

fType :: Char-> Char 
fType x = 'K' 
main = do  
   let x = 'v' 
   print (fType x) 

Haskell Boolean type class

main = do  
   let x = True 
   
   if x == False 
      then putStrLn "X matches with Bool Type" 
   else putStrLn "X is not a Bool Type" 

Haskell Double type class

fType :: Double -> Double -> Double 
fType x y = x*x + y*y 
main = print (fType 2.56 3.81)

Haskell Float type class

fType :: Float -> Float -> Float 
fType x y = x*x + y*y 
main = print (fType 2.5 3.8)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.