Haskell 6-module

Download Haskell 6-module

Post on 12-Jul-2015

550 views

Category:

Technology

4 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>6</p><p>H</p></li><li><p>Haskell</p><p>Haskell</p></li><li><p>import ModuleName</p><p>import ModuleName1</p><p>import ModuleName2</p></li><li><p>Data.List</p><p>import Data.List</p><p>numUniques :: (Eq a) =&gt; [a] -&gt; Int</p><p>numUniques = length . nub #()</p><p>numUniques xs = length (nub xs) #()</p><p>numUniques = xs -&gt; length (nub xs) #()</p></li><li><p>GHCi</p><p>ghci&gt; :m + Data.List</p><p>GHCi</p><p>ghci&gt; :m + Data.List Data.map Data.Set</p></li><li><p>import Data.List (nub, sort)</p><p>import Data.List hiding (nub)</p></li><li><p>(qualified)</p></li><li><p>Data.Map.filter</p><p>Prelude.filter</p><p>import qualified Data.Map</p><p>Data.Map.filter ...</p><p>import qualified Data.Map as M</p><p>M.filter ...</p></li><li><p>qualified.</p></li><li><p>Geometry.hs</p></li><li><p>Geometry.hs -&gt; module Geometry</p></li><li><p>3</p><p> module Geometry</p><p> (sphereVolume,</p><p> ...</p><p> )where</p></li><li><p>4</p><p>module Geometry</p><p> (sphereVolume,</p><p> ...</p><p> )where</p><p>sphereVolume :: Float -&gt; Float</p><p> sphereVolume = (4.0/3.0) * pi * (radius ^ 3)</p></li><li><p>&gt;</p></li><li><p>Geometry</p></li><li><p>Sphere.hs</p><p>Cuboid.hs</p><p>Cube.hs</p></li><li><p>3</p><p>Geometry/Sphere.hs</p><p> -&gt; module Geometry.Sphere</p></li><li><p>3</p><p> module Geometry.Sphere</p><p> (volume,</p><p> area</p><p> )where</p></li><li><p>4</p><p>module Geometry.Sphere</p><p> (Volume,</p><p> area</p><p> )where</p><p>Volume :: Float -&gt; Float</p><p> Volume = (4.0/3.0) * pi * (radius ^ 3)</p></li><li><p>Geometry.Sphere.volume</p><p>Geometry.Cuboid.volume</p><p>Geometry.Cube.volume</p></li><li><p>Haskell</p></li></ul>