Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Point data constructor
- data Point = Point Int Int
- -- assuming import Data.Map in the beginning of the file
- makeWordMap ss = fromList $ [(w, s) | s <- ss, w <- words s]
- -- A plotter class which we can make for any kind of a plotter
- class Plotter where
- plot :: Point -> IO ()
- plotSquares p n = sequence $ map (plot p) [Point x x+1 | x <- [0..n]]
- -- getting songs, do syntax
- getSongLength a b s = do album <- getAlbum a b
- song <- getSong b s
- return (length song)
- -- alternatively a bit shorter and more intuitive
- getSongLength a b s =
- fmap length $ getArtist a >>= getAlbum b >>= getSong s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement