Sha256: 663da6b4460471afab6aa60dd69d6c92bc1a51a3f4a27a6e057608e1d6afafbd

Contents?: true

Size: 270 Bytes

Versions: 396

Compression:

Stored size: 270 Bytes

Contents

module Grains (square, total) where

import Data.Maybe (fromJust)

square :: Integer -> Maybe Integer
square x
    | x < 1     = Nothing
    | x > 64    = Nothing
    | otherwise = Just . (2^) . pred $ x

total :: Integer
total = sum . map (fromJust . square) $ [1..64]

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.77 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.76 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.75 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.74 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.73 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.72 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.71 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.70 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.69 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.68 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.67 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.66 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.65 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.64 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.63 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.62 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.61 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.60 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.59 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs