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.159 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.158 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.157 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.156 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.155 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.154 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.153 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.152 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.151 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.150 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.149 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.148 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.147 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.146 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.145 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.144 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.143 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.142 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.141 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs
trackler-2.2.1.140 tracks/haskell/exercises/grains/examples/success-standard/src/Grains.hs