samedi 30 octobre 2021

How can I run this function when it can work on CMD

module Examples where 
   import System.Random
   import Data.List
   cars = ["Ferrari", "Audi", "Honda","McLaren","Merc"]
   cmp (x1,y1) (x2,y2) = compare y1 y2
   [car | (car, n) <- sortBy cmp(zip cars (randoms (mkStdGen 123456) :: [Int]))]

I keep getting this error:

Parse error: module header, import declaration or top-level declaration expected. | 7 | [car | (car, n) <- sortBy cmp(zip cars (randoms (mkStdGen 123456) :: [Int]))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :reload

Does anyone have any idea for me to fix this so this function can run




Aucun commentaire:

Enregistrer un commentaire