From 4b951aaeb3bf8a322c634154aedc898b4d8a1285 Mon Sep 17 00:00:00 2001 From: Marcin Tolysz Date: Sun, 26 Jun 2016 01:22:25 +0100 Subject: [PATCH] Move module to a package fix for moreng ghc --- .gitignore | 4 +++- HaskellViewer.cabal | 6 +++--- AIFF.hs => HaskellViewer/AIFF.hs | 4 ++-- Displayable.hs => HaskellViewer/Displayable.hs | 2 +- HaskellViewer/Playable.hs | 11 +++++++++++ Viewer.hs => HaskellViewer/Viewer.hs | 12 ++++++------ Playable.hs | 12 ------------ stack.yaml | 10 ++++++++++ 8 files changed, 36 insertions(+), 25 deletions(-) rename AIFF.hs => HaskellViewer/AIFF.hs (96%) rename Displayable.hs => HaskellViewer/Displayable.hs (98%) create mode 100644 HaskellViewer/Playable.hs rename Viewer.hs => HaskellViewer/Viewer.hs (88%) delete mode 100644 Playable.hs create mode 100644 stack.yaml diff --git a/.gitignore b/.gitignore index 6a0adc6..c659643 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ dist/ *.aiff - +.stack-work +.idea +*.iml diff --git a/HaskellViewer.cabal b/HaskellViewer.cabal index 7bafcae..9934e6b 100644 --- a/HaskellViewer.cabal +++ b/HaskellViewer.cabal @@ -16,6 +16,6 @@ build-type: Simple cabal-version: >=1.8 library - exposed-modules: Displayable, Viewer, Playable - other-modules: AIFF - build-depends: base ==4.6.*, HPDF >=1.4.5, network ==2.4.*, bytestring ==0.10.* \ No newline at end of file + exposed-modules: HaskellViewer.Displayable, HaskellViewer.Viewer, HaskellViewer.Playable + other-modules: HaskellViewer.AIFF + build-depends: base > 4.5 && < 5, HPDF >=1.4.5, network, bytestring diff --git a/AIFF.hs b/HaskellViewer/AIFF.hs similarity index 96% rename from AIFF.hs rename to HaskellViewer/AIFF.hs index ab3453f..127aa27 100644 --- a/AIFF.hs +++ b/HaskellViewer/AIFF.hs @@ -1,4 +1,4 @@ -module AIFF( +module HaskellViewer.AIFF( encodeSound ) where @@ -75,4 +75,4 @@ encodeSound sampling samples = common sampling nbSamples <> sound samples nbSamples in - toLazyByteString r \ No newline at end of file + toLazyByteString r diff --git a/Displayable.hs b/HaskellViewer/Displayable.hs similarity index 98% rename from Displayable.hs rename to HaskellViewer/Displayable.hs index a491301..2a26bfb 100644 --- a/Displayable.hs +++ b/HaskellViewer/Displayable.hs @@ -7,7 +7,7 @@ By default, any Draw() value can be displayed ! -} -module Displayable( +module HaskellViewer.Displayable( Displayable(..) , Rsrc(..) , DrawingAction(..) diff --git a/HaskellViewer/Playable.hs b/HaskellViewer/Playable.hs new file mode 100644 index 0000000..b8eeedf --- /dev/null +++ b/HaskellViewer/Playable.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE FlexibleInstances #-} +module HaskellViewer.Playable( + Playable(..) + ) where + +class Playable a where + sound :: a -> (Double,[Double]) + +instance Playable (Double,[Double]) where + sound = id + diff --git a/Viewer.hs b/HaskellViewer/Viewer.hs similarity index 88% rename from Viewer.hs rename to HaskellViewer/Viewer.hs index 7cd28cd..7f4424b 100644 --- a/Viewer.hs +++ b/HaskellViewer/Viewer.hs @@ -1,27 +1,27 @@ {- | Functions used to communicate with the OS X hViewer -} -module Viewer( +module HaskellViewer.Viewer( display , viewerSize , play ) where import Graphics.PDF -import Displayable -import Playable +import HaskellViewer.Displayable +import HaskellViewer.Playable import Network import qualified Data.ByteString.Lazy.Char8 as L import qualified Data.ByteString.Lazy.Builder as B import GHC.IO.Handle(hFlush,hClose) -import AIFF(encodeSound) +import HaskellViewer.AIFF(encodeSound) dispCode = L.pack "disp" playCode = L.pack "play" -- | Convert a Displayable into a PDF byetstream -getPDFStream :: Displayable a b => Int -> Int -> a -> IO L.ByteString +getPDFStream :: Displayable a b => Int -> Int -> a -> L.ByteString getPDFStream width height drawingCode = do let rect = PDFRect 0 0 width height let (aPdfValue, drawAction) = drawing drawingCode @@ -45,7 +45,7 @@ display :: Displayable a b -> IO () display d = do let (w,h) = viewerSize - stream <- getPDFStream w h d + let stream = getPDFStream w h d sendStream 9000 (L.append dispCode stream) play :: Playable a diff --git a/Playable.hs b/Playable.hs deleted file mode 100644 index 8f7a956..0000000 --- a/Playable.hs +++ /dev/null @@ -1,12 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -module Playable( - Playable(..) - ) where - -class Playable a where - sound :: a -> (Double,[Double]) - -instance Playable (Double,[Double]) where - sound = id - - \ No newline at end of file diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..72c8bc2 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,10 @@ + +resolver: lts-6.4 + +packages: +- '.' +extra-deps: [] + +flags: {} + +extra-package-dbs: []