This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Follow instructions from (https://www.haskell.org/ghcup/) to install Haskell-Language-Server | |
-- Neither do code actions nor code lenses are available when selecting eligible code, while in other | |
-- editors they are available | |
-- More code actions are available in other editors | |
-- func xs = sum xs | |
-- func = sum | |
func :: (Foldable t, Num a)=> t a -> a | |
func xs = foldl (+) 0 xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isPrime :: Int -> Int | |
isPrime = helper 2 | |
where helper :: Int -> Int -> Int | |
helper count num | |
| prime = if count <= div num 2 | |
then helper (count+1) num | |
else 1 | |
| otherwise = 0 | |
where prime = (num == 2) || (mod num count /= 0) |