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.139 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.138 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.137 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.136 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.135 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.134 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.133 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.132 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.131 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.130 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.129 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.128 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.127 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.126 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.125 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.124 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.123 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.122 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.121 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.120 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs