Fix build and freeze

This commit is contained in:
Julian Ospald 2019-12-05 12:19:55 +08:00
parent cfb428a70e
commit 8643826810
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
8 changed files with 202 additions and 118 deletions

View File

@ -177,9 +177,11 @@ executable Test
base >=4.6, base >=4.6,
bytestring >= 0.10.4.0, bytestring >= 0.10.4.0,
containers >= 0.5.0.0, containers >= 0.5.0.0,
dequeue >= 0.1.12,
diagrams-lib >=1.3, diagrams-lib >=1.3,
diagrams-cairo >=1.3, diagrams-cairo >=1.3,
diagrams-contrib >= 1.3.0.0, diagrams-contrib >= 1.3.0.0,
JuicyPixels >= 3.1.7.1,
QuickCheck >= 2.4.2, QuickCheck >= 2.4.2,
safe >= 0.3.8 safe >= 0.3.8

View File

@ -57,23 +57,24 @@ instance Def DiagProp where
def = diagDefaultProp def = diagDefaultProp
instance Monoid Diag where instance Semigroup Diag where
mempty = EmptyDiag mempty d1@(Diag {}) <> d2@(Diag {}) = Diag g
mappend d1@(Diag {}) d2@(Diag {}) = Diag g
where where
g p obj = mkDiag d1 p obj <> mkDiag d2 p obj g p obj = mkDiag d1 p obj <> mkDiag d2 p obj
mappend d1@(GifDiag {}) d2@(Diag {}) = GifDiag g d1@(GifDiag {}) <> d2@(Diag {}) = GifDiag g
where where
g p col f vt = mkGifDiag d1 p col f vt ++ [mkDiag d2 p [vt]] g p col f vt = mkGifDiag d1 p col f vt ++ [mkDiag d2 p [vt]]
mappend d1@(Diag {}) d2@(GifDiag {}) = GifDiag g d1@(Diag {}) <> d2@(GifDiag {}) = GifDiag g
where where
g p col f vt = mkDiag d2 p [vt] : mkGifDiag d1 p col f vt g p col f vt = mkDiag d2 p [vt] : mkGifDiag d1 p col f vt
mappend d1@(GifDiag {}) d2@(GifDiag {}) = GifDiag g d1@(GifDiag {}) <> d2@(GifDiag {}) = GifDiag g
where where
g p col f vt = mkGifDiag d1 p col f vt ++ mkGifDiag d2 p col f vt g p col f vt = mkGifDiag d1 p col f vt ++ mkGifDiag d2 p col f vt
mappend (EmptyDiag _) g = g (EmptyDiag _) <> g = g
mappend g (EmptyDiag _) = g g <> (EmptyDiag _) = g
instance Monoid Diag where
mempty = EmptyDiag mempty
mconcat = foldr mappend mempty mconcat = foldr mappend mempty

View File

@ -63,7 +63,7 @@ diagS p mesh =
diag p diagAlgos diag p diagAlgos
. fmap (filterValidPT p) . fmap (filterValidPT p)
. (\x -> if null x then [meshToArr mesh] else x) . (\x -> if null x then [meshToArr mesh] else x)
. facesToArr . parseObj
$ mesh $ mesh
@ -74,6 +74,6 @@ diagTreeS p mesh =
diag p diagTreAlgos diag p diagTreAlgos
. fmap (filterValidPT p) . fmap (filterValidPT p)
. (\x -> if null x then [meshToArr mesh] else x) . (\x -> if null x then [meshToArr mesh] else x)
. facesToArr . parseObj
$ mesh $ mesh

View File

@ -29,6 +29,7 @@ import Control.Monad
import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap.Lazy as Map import qualified Data.IntMap.Lazy as Map
import Data.Maybe import Data.Maybe
import Diagrams.TwoD.Types
import Parser.Meshparser import Parser.Meshparser
import Safe import Safe
@ -231,10 +232,10 @@ buildHeEdge pts fs
-- |Build the HeEdge data structure from the .obj mesh file contents. -- |Build the HeEdge data structure from the .obj mesh file contents.
buildHeEdgeFromStr :: B.ByteString -- ^ contents of an .obj mesh file buildHeEdgeFromStr :: B.ByteString -- ^ contents of an .obj mesh file
-> HeEdge PT -> HeEdge (P2 Double)
buildHeEdgeFromStr bmesh = buildHeEdgeFromStr bmesh =
let pts = meshVertices bmesh let pts = meshToArr bmesh
faces' = indirectHeFaces . meshFaces $ bmesh faces' = indirectHeFaces . facesToArr $ bmesh
edges = indirectHeEdges faces' edges = indirectHeEdges faces'
verts = indirectHeVerts edges verts = indirectHeVerts edges
in indirectToDirect pts edges faces' verts in indirectToDirect pts edges faces' verts

View File

@ -1,6 +1,6 @@
{-# OPTIONS_HADDOCK ignore-exports #-} {-# OPTIONS_HADDOCK ignore-exports #-}
module Parser.Meshparser (meshToArr, facesToArr) where module Parser.Meshparser (meshToArr, facesToArr, parseObj) where
import Control.Applicative import Control.Applicative
import Data.Attoparsec.ByteString.Char8 import Data.Attoparsec.ByteString.Char8
@ -9,13 +9,8 @@ import qualified Data.ByteString.Char8 as B
import Diagrams.TwoD.Types import Diagrams.TwoD.Types
-- |Convert a text String with multiple vertices and faces into facesToArr :: B.ByteString -> [[Int]]
-- a list of vertices, ordered by the faces specification. facesToArr = rights . fmap (parseOnly parseFace) . B.lines
facesToArr :: B.ByteString -> [[P2 Double]]
facesToArr str = fmap (fmap (\y -> meshToArr str !! (fromIntegral y - 1)))
(faces str)
where
faces = rights . fmap (parseOnly parseFace) . B.lines
-- |Convert a text String with multiple vertices into -- |Convert a text String with multiple vertices into
@ -37,5 +32,14 @@ parseVertice =
<*> (many' space *> double) <*> (many' space *> double)
parseFace :: Parser [Integer] parseFace :: Parser [Int]
parseFace = char 'f' *> many1' (many' space *> decimal) parseFace = char 'f' *> many1' (many' space *> decimal)
-- |Convert a text String with multiple vertices and faces into
-- a list of vertices, ordered by the faces specification.
parseObj :: B.ByteString -> [[P2 Double]]
parseObj str = fmap (fmap (\y -> meshToArr str !! (fromIntegral y - 1)))
(faces str)
where
faces = rights . fmap (parseOnly parseFace) . B.lines

3
cabal.project Normal file
View File

@ -0,0 +1,3 @@
with-compiler: ghc-8.6.5
packages: *.cabal

169
cabal.project.freeze Normal file
View File

@ -0,0 +1,169 @@
constraints: any.Boolean ==0.2.4,
any.Cabal ==2.4.0.1,
any.JuicyPixels ==3.3.4,
JuicyPixels -mmap,
any.MemoTrie ==0.6.10,
MemoTrie -examples,
any.MonadRandom ==0.5.1.1,
any.NumInstances ==1.4,
any.QuickCheck ==2.13.2,
QuickCheck +templatehaskell,
any.StateVar ==1.2,
any.active ==0.2.0.14,
any.adjunctions ==4.4,
any.alex ==3.2.5,
alex +small_base,
any.ansi-terminal ==0.10.2,
ansi-terminal -example,
any.ansi-wl-pprint ==0.6.9,
ansi-wl-pprint -example,
any.array ==0.5.3.0,
any.async ==2.2.2,
async -bench,
any.attoparsec ==0.13.2.3,
attoparsec -developer,
any.base ==4.12.0.0,
any.base-orphans ==0.8.1,
any.bifunctors ==5.5.6,
bifunctors +semigroups +tagged,
any.binary ==0.8.6.0,
any.binary-orphans ==1.0.1,
any.bytes ==0.16,
bytes +test-doctests,
any.bytestring ==0.10.8.2,
any.cabal-doctest ==1.0.8,
any.cairo ==0.13.6.1,
cairo +cairo_pdf +cairo_ps +cairo_svg,
any.call-stack ==0.2.0,
any.cereal ==0.5.8.1,
cereal -bytestring-builder,
any.circle-packing ==0.1.0.6,
any.colour ==2.3.5,
any.comonad ==5.0.6,
comonad +containers +distributive +test-doctests,
any.constraints ==0.11.2,
any.containers ==0.6.0.1,
any.contravariant ==1.5.2,
contravariant +semigroups +statevar +tagged,
any.cubicbezier ==0.6.0.6,
cubicbezier -debug,
any.data-default ==0.7.1.1,
any.data-default-class ==0.1.2.0,
any.data-default-instances-containers ==0.0.1,
any.data-default-instances-dlist ==0.0.1,
any.data-default-instances-old-locale ==0.0.1,
any.deepseq ==1.4.4.0,
any.dequeue ==0.1.12,
any.diagrams-cairo ==1.4.1,
any.diagrams-contrib ==1.4.4,
any.diagrams-core ==1.4.2,
any.diagrams-lib ==1.4.3,
any.diagrams-solve ==0.1.1,
any.directory ==1.3.3.0,
any.distributive ==0.6.1,
distributive +semigroups +tagged,
any.dlist ==0.8.0.7,
any.dual-tree ==0.2.2.1,
any.enclosed-exceptions ==1.0.3,
any.exceptions ==0.10.3,
any.fast-math ==1.0.2,
any.filepath ==1.4.2.1,
any.fingertree ==0.1.4.2,
any.force-layout ==0.4.0.6,
any.free ==5.1.3,
any.fsnotify ==0.3.0.1,
any.ghc-boot-th ==8.6.5,
any.ghc-prim ==0.5.3,
any.gio ==0.13.6.1,
any.glib ==0.13.7.1,
glib +closure_signals,
any.groups ==0.4.1.0,
any.gtk ==0.15.3,
gtk +deprecated +fmode-binary +have-gio -have-quartz-gtk,
any.gtk2hs-buildtools ==0.13.5.4,
gtk2hs-buildtools +closuresignals,
any.happy ==1.19.12,
happy +small_base,
any.hashable ==1.2.7.0,
hashable -examples +integer-gmp +sse2 -sse41,
any.hashtables ==1.2.3.4,
hashtables -bounds-checking -debug -detailed-profiling -portable -sse42 +unsafe-tricks,
any.hinotify ==0.4,
any.integer-gmp ==1.0.2.0,
any.integer-logarithms ==1.0.3,
integer-logarithms -check-bounds +integer-gmp,
any.integration ==0.2.1,
any.intervals ==0.9,
intervals -herbie +test-doctests,
any.invariant ==0.5.3,
any.kan-extensions ==5.2,
any.lens ==4.17.1,
lens -benchmark-uniplate -dump-splices +inlining -j -old-inline-pragmas -safe +test-doctests +test-hunit +test-properties +test-templates +trustworthy,
any.lifted-async ==0.10.0.4,
any.lifted-base ==0.2.3.12,
any.linear ==1.20.9,
linear -herbie +template-haskell,
any.matrices ==0.5.0,
any.mfsolve ==0.3.2.0,
any.microlens ==0.4.11.2,
any.microlens-mtl ==0.2.0.1,
any.microlens-th ==0.4.3.2,
any.monad-control ==1.0.2.3,
any.monoid-extras ==0.5.1,
any.mtl ==2.2.2,
any.mtl-compat ==0.2.2,
mtl-compat -two-point-one -two-point-two,
any.newtype-generics ==0.5.4,
any.old-locale ==1.0.0.7,
any.optparse-applicative ==0.14.3.0,
any.pango ==0.13.6.1,
pango +new-exception,
any.parallel ==3.2.2.0,
any.parsec ==3.1.13.0,
any.pretty ==1.1.3.6,
any.primitive ==0.7.0.0,
any.process ==1.6.5.0,
any.profunctors ==5.5.1,
any.random ==1.1,
any.reflection ==2.1.5,
reflection -slow +template-haskell,
any.rts ==1.0,
any.safe ==0.3.17,
any.scientific ==0.3.6.2,
scientific -bytestring-builder -integer-simple,
any.semigroupoids ==5.3.4,
semigroupoids +comonad +containers +contravariant +distributive +doctests +tagged +unordered-containers,
any.semigroups ==0.19.1,
semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers,
any.shelly ==1.9.0,
shelly -build-examples -lifted,
any.split ==0.2.3.3,
any.splitmix ==0.0.3,
splitmix -optimised-mixer +random,
any.statestack ==0.2.0.5,
any.stm ==2.5.0.0,
any.tagged ==0.8.6,
tagged +deepseq +transformers,
any.template-haskell ==2.14.0.0,
any.text ==1.2.3.1,
any.th-abstraction ==0.3.1.0,
any.time ==1.8.0.2,
any.transformers ==0.5.6.2,
any.transformers-base ==0.4.5.2,
transformers-base +orphaninstances,
any.transformers-compat ==0.6.5,
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
any.type-equality ==1,
any.unix ==2.7.2.2,
any.unix-compat ==0.5.2,
unix-compat -old-time,
any.unordered-containers ==0.2.10.0,
unordered-containers -debug,
any.utf8-string ==1.0.1.1,
any.vector ==0.12.0.3,
vector +boundschecks -internalchecks -unsafechecks -wall,
any.vector-space ==0.16,
any.void ==0.7.3,
void -safe,
any.zlib ==0.6.2.1,
zlib -non-blocking-ffi -pkg-config

View File

@ -1,96 +0,0 @@
flags:
text:
integer-simple: false
QuickCheck:
base4point8: false
packages:
- '.'
extra-deps:
- GLURaw-1.4.0.2
- GLUT-2.5.1.1
- JuicyPixels-3.2.6.1
- MonadRandom-0.4
- OpenGL-2.9.2.0
- OpenGLRaw-1.5.0.1
- QuickCheck-2.8.1
- StateVar-1.1.0.1
- active-0.2.0.4
- adjunctions-4.2.1
- ansi-terminal-0.6.2.2
- ansi-wl-pprint-0.6.7.3
- async-2.0.2
- attoparsec-0.13.0.1
- base-orphans-0.4.4
- bifunctors-5
- bmp-1.2.5.2
- bytes-0.15.0.1
- cairo-0.12.5.3
- cereal-0.4.1.1
- circle-packing-0.1.0.4
- colour-2.3.3
- comonad-4.2.7.2
- contravariant-1.3.3
- data-default-0.5.3
- data-default-class-0.0.1
- data-default-instances-base-0.0.1
- data-default-instances-containers-0.0.1
- data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1
- dequeue-0.1.12
- diagrams-cairo-1.3.0.3
- diagrams-contrib-1.3.0.5
- diagrams-core-1.3.0.2
- diagrams-lib-1.3.0.3
- diagrams-solve-0.1
- distributive-0.4.4
- dlist-0.7.1.2
- dual-tree-0.2.0.6
- exceptions-0.8.0.2
- fingertree-0.1.1.0
- force-layout-0.4.0.2
- free-4.12.1
- fsnotify-0.2.1
- gio-0.12.5.3
- glade-0.12.5.0
- glib-0.12.5.4
- gloss-1.9.2.1
- gloss-rendering-1.9.2.1
- groups-0.4.0.0
- gtk-0.12.5.7
- hashable-1.2.3.3
- hinotify-0.3.8.1
- intervals-0.7.1
- kan-extensions-4.2.2
- lens-4.12.3
- linear-1.19.1.3
- monoid-extras-0.4.0.1
- mtl-2.2.1
- nats-1
- newtype-0.2
- optparse-applicative-0.11.0.2
- pango-0.12.5.3
- parallel-3.2.0.6
- parsec-3.1.9
- prelude-extras-0.4
- primitive-0.6
- profunctors-5.1.1
- random-1.1
- reflection-2
- safe-0.3.9
- scientific-0.3.3.8
- semigroupoids-5.0.0.4
- semigroups-0.16.2.2
- split-0.2.2
- statestack-0.2.0.4
- stm-2.4.4
- tagged-0.8.1
- text-1.2.1.3
- tf-random-0.5
- transformers-compat-0.4.0.4
- unix-compat-0.4.1.4
- unordered-containers-0.2.5.1
- utf8-string-0.3.8
- vector-0.11.0.0
- void-0.7
- zlib-0.6.1.1
resolver: ghc-7.8