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.58 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.57 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.56 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.55 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.54 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.53 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.52 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.51 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.50 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.49 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.48 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.47 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.46 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.45 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.44 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.43 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.42 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.41 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.40 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.39 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs