Guest User

Untitled

a guest
Dec 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class Magic a where
  2. conjure :: String -> [a]
  3. magikStorage :: [a] -> String
  4.  
  5. -- Use return type
  6. doMagik :: Magic a => Int -> [a]
  7. doMagik n = concat $ replicate n res
  8. where
  9. res = conjure $ magikStorage res -- Must be lazy in res !!!!
  10.  
  11. -- Pass dummy parameter
  12. anotherMagic :: Magic a => Int -> [a]
  13. anotherMagic n = concat $ replicate n $ go []
  14. where
  15. go :: Magic a => [a] -> [a]
  16. go x = conjure $ magikStorage x
Add Comment
Please, Sign In to add comment