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.8.15 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.14 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.13 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.12 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.11 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.10 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.9 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.8 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.7 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.6 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.5 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.4 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.3 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.2 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.8.1 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.7.0 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.44 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.43 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.42 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.0.6.41 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs