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.0.6.40 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.39 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.38 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.37 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.36 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.35 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.34 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.33 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.32 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.31 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.30 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.29 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.28 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.27 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.26 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.25 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.24 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.23 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.22 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.21 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs