Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make GeomAlgLib compatible with Applicative-Monad-Proposal in GHC>=7.10 #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions package.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ Category: Computational Geometry
Synopsis: A library of geometric algorithms for Haskell
Copyright: (c) 1997, 1998, 2008 by Joern Dinkla, www.dinkla.net
Maintainer: [email protected]
Build-Type: Simple

Flag buildExamples
description: Build example executables
default: False

Library
Build-Depends: base > 4, array, containers
Build-Depends:
prelude-compat >=0.0.0.1 && <0.1,
array,
containers,
base > 4
GHC-Options: -package ghc
hs-source-dirs: src
Exposed-modules:
Expand All @@ -28,41 +37,56 @@ Library
Tests.Test, Tests.Polys,
Applications.AllNearest, Applications.ClosestPair, Applications.DelaunayHull, Applications.MaxEmptyCircle,
Applications.NearestPoint, Applications.OnionLayers
Other-modules:
Basics.FiniteMap

Executable convexHulls
Main-Is: Tests/ConvexHulls.hs
hs-source-dirs: src
Other-Modules: GrahamsScan, JarvisMarch, MergeHull, KirkpatrickSeidelHull, ChansConvexHull
GHC-Options: -package ghc
If !flag(buildExamples)
Buildable: False

Executable nearest
Main-Is: Tests/Nearest.hs
hs-source-dirs: src
Other-Modules: Applications.NearestPoint DelaunayDAG
GHC-Options: -package ghc
If !flag(buildExamples)
Buildable: False

Executable rangeQueries
Main-Is: Tests/RangeQueries.hs
hs-source-dirs: src
Other-Modules: KDTree RangeTree
GHC-Options: -package ghc
If !flag(buildExamples)
Buildable: False

Executable triangulations
Main-Is: Tests/Triangulations.hs
hs-source-dirs: src
Other-Modules: ConvexTriangulation, NaiveTriangulation, MonotoneTriangulation, GareysTriangulation,
KETTriangulation, AdaptTriangulation, MergeTriangulation
GHC-Options: -package ghc
If !flag(buildExamples)
Buildable: False

Executable voronoiDelaunay
Main-Is: Tests/VoronoiDelaunay.lhs
hs-source-dirs: src
Other-Modules: Delaunay Voronoi
GHC-Options: -package ghc
If !flag(buildExamples)
Buildable: False

Executable glConvexHulls
Main-Is: OpenGL/GL_ConvexHulls.lhs
hs-source-dirs: src
Other-Modules: GrahamsScan, JarvisMarch, MergeHull, KirkpatrickSeidelHull, ChansConvexHull
Build-Depends: base, array, GLUT
GHC-Options: -package ghc
If flag(buildExamples)
Build-Depends: base, array, GLUT
Else
Buildable: False
3 changes: 3 additions & 0 deletions src/Basics/Pretty.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ module Basics.Pretty (
render, fullRender
) where

import Prelude2010
import Prelude ()

-- Don't import Util( assertPanic ) because it makes a loop in the module structure

infixl 6 <>
Expand Down
7 changes: 7 additions & 0 deletions src/Basics/Topped.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ a topped domain

> module Basics.Topped where
>
> import Control.Applicative (Applicative, pure, (<*>))
>
> import Prelude hiding (RealFloat (isInfinite))
>
> data Topped a = Finite a | Infty
Expand All @@ -26,6 +28,11 @@ a topped domain
> fmap f (Finite a) = Finite (f a)
> fmap f Infty = Infty
>
> instance Applicative Topped where
> Finite f <*> Finite x = Finite $ f x
> _ <*> _ = Infty
> pure = Finite
>
> instance Monad Topped where
> Infty >>= k = Infty
> Finite x >>= k = k x
Expand Down
3 changes: 3 additions & 0 deletions src/Line.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import Point ( Point ((<+>),(<*>)), Point3, xcoord, ycoord, zcoord,
import Point2 ( Point2 (..), P2, Orientation (..), orientation, angle2 )
import Data.Maybe ( isJust, fromJust )
import qualified Point2 (translate, rotateOrg, reflect, rotate)

import Prelude2010
import Prelude ()
\end{code}

\begin{code}
Expand Down
3 changes: 3 additions & 0 deletions src/Polygon.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import Line ( Line (..), fromPDL, distanceFromLine, intersect, doIntersect
import Basics.Utilities ( rotateL, rotateR, rotateTo, snd3, uncurry3, rotateToBy )
import qualified Triangle
import Data.Array ( Array, listArray, (!) )

import Prelude2010
import Prelude ()
\end{code}

\begin{code}
Expand Down
3 changes: 3 additions & 0 deletions src/Tests/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import Data.List ( zip4 )
import Basics.Random ( randomInts, randomDoubles )
import Basics.Utilities ( splitsAt )

import Prelude2010
import Prelude ()

--
-- PSEUDO-ZUFLLIGE MENGEN VON PUNKTEN
--
Expand Down