Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
2415aefd
Commit
2415aefd
authored
Apr 30, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes #142
parent
268bf239
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
10 deletions
+22
-10
Charts.hs
ihaskell-display/ihaskell-charts/IHaskell/Display/Charts.hs
+1
-3
Diagrams.hs
...ll-display/ihaskell-diagrams/IHaskell/Display/Diagrams.hs
+1
-3
Juicypixels.hs
...play/ihaskell-juicypixels/IHaskell/Display/Juicypixels.hs
+2
-3
ihaskell.cabal
ihaskell.cabal
+2
-1
Display.hs
src/IHaskell/Display.hs
+16
-0
No files found.
ihaskell-display/ihaskell-charts/IHaskell/Display/Charts.hs
View file @
2415aefd
...
@@ -30,9 +30,7 @@ instance IHaskellDisplay (Renderable a) where
...
@@ -30,9 +30,7 @@ instance IHaskellDisplay (Renderable a) where
chartData
::
Renderable
a
->
FileFormat
->
IO
DisplayData
chartData
::
Renderable
a
->
FileFormat
->
IO
DisplayData
chartData
renderable
format
=
do
chartData
renderable
format
=
do
-- Switch to a temporary directory so that any files we create aren't
switchToTmpDir
-- visible. On Unix, this is usually /tmp.
try
(
getTemporaryDirectory
>>=
setCurrentDirectory
)
::
IO
(
Either
SomeException
()
)
-- Write the PNG image.
-- Write the PNG image.
let
filename
=
".ihaskell-chart.png"
let
filename
=
".ihaskell-chart.png"
...
...
ihaskell-display/ihaskell-diagrams/IHaskell/Display/Diagrams.hs
View file @
2415aefd
...
@@ -20,9 +20,7 @@ instance IHaskellDisplay (Diagram Cairo R2) where
...
@@ -20,9 +20,7 @@ instance IHaskellDisplay (Diagram Cairo R2) where
diagramData
::
Diagram
Cairo
R2
->
OutputType
->
IO
DisplayData
diagramData
::
Diagram
Cairo
R2
->
OutputType
->
IO
DisplayData
diagramData
renderable
format
=
do
diagramData
renderable
format
=
do
-- Switch to a temporary directory so that any files we create aren't
switchToTmpDir
-- visible. On Unix, this is usually /tmp.
try
(
getTemporaryDirectory
>>=
setCurrentDirectory
)
::
IO
(
Either
SomeException
()
)
-- Compute width and height.
-- Compute width and height.
let
w
=
width
renderable
let
w
=
width
renderable
...
...
ihaskell-display/ihaskell-juicypixels/IHaskell/Display/Juicypixels.hs
View file @
2415aefd
...
@@ -29,9 +29,8 @@ instance IHaskellDisplay (Image PixelCMYK16) where display = displayImageAsJpg .
...
@@ -29,9 +29,8 @@ instance IHaskellDisplay (Image PixelCMYK16) where display = displayImageAsJpg .
-- main rendering function
-- main rendering function
displayImageAsJpg
::
DynamicImage
->
IO
Display
displayImageAsJpg
::
DynamicImage
->
IO
Display
displayImageAsJpg
renderable
=
do
displayImageAsJpg
renderable
=
do
-- Switch to a temporary directory so that any files we create aren't
switchToTmpDir
-- visible. On Unix, this is usually /tmp.
try
(
getTemporaryDirectory
>>=
setCurrentDirectory
)
::
IO
(
Either
SomeException
()
)
let
filename
=
".ihaskell.juicypixels.jpg"
let
filename
=
".ihaskell.juicypixels.jpg"
-- Write the image
-- Write the image
saveJpgImage
95
filename
renderable
saveJpgImage
95
filename
renderable
...
...
ihaskell.cabal
View file @
2415aefd
...
@@ -91,7 +91,8 @@ library
...
@@ -91,7 +91,8 @@ library
stm -any,
stm -any,
text -any,
text -any,
utf8-string -any,
utf8-string -any,
vector -any
vector -any,
temporary ==1.2.*
exposed-modules: IHaskell.Display
exposed-modules: IHaskell.Display
IHaskell.Convert
IHaskell.Convert
...
...
src/IHaskell/Display.hs
View file @
2415aefd
...
@@ -9,6 +9,7 @@ module IHaskell.Display (
...
@@ -9,6 +9,7 @@ module IHaskell.Display (
Display
(
..
),
Display
(
..
),
DisplayData
(
..
),
DisplayData
(
..
),
printDisplay
,
printDisplay
,
switchToTmpDir
,
-- Internal only use
-- Internal only use
displayFromChan
,
displayFromChan
,
...
@@ -23,6 +24,10 @@ import qualified Data.ByteString.Base64 as Base64
...
@@ -23,6 +24,10 @@ import qualified Data.ByteString.Base64 as Base64
import
qualified
Data.ByteString.Char8
as
Char
import
qualified
Data.ByteString.Char8
as
Char
import
Data.Aeson
(
Value
)
import
Data.Aeson
(
Value
)
import
System.Directory
(
getTemporaryDirectory
,
setCurrentDirectory
)
import
System.IO.Temp
(
createTempDirectory
)
import
Control.Concurrent.STM.TChan
import
Control.Concurrent.STM.TChan
import
System.IO.Unsafe
(
unsafePerformIO
)
import
System.IO.Unsafe
(
unsafePerformIO
)
...
@@ -122,3 +127,14 @@ unfoldM f = maybe (return []) (\r -> (r:) <$> unfoldM f) =<< f
...
@@ -122,3 +127,14 @@ unfoldM f = maybe (return []) (\r -> (r:) <$> unfoldM f) =<< f
-- notebook once the current execution call ends.
-- notebook once the current execution call ends.
printDisplay
::
IHaskellDisplay
a
=>
a
->
IO
()
printDisplay
::
IHaskellDisplay
a
=>
a
->
IO
()
printDisplay
disp
=
display
disp
>>=
atomically
.
writeTChan
displayChan
printDisplay
disp
=
display
disp
>>=
atomically
.
writeTChan
displayChan
-- | Convenience function for client libraries. Switch to a temporary
-- directory so that any files we create aren't visible. On Unix, this is
-- usually /tmp.
switchToTmpDir
=
void
(
try
switchDir
::
IO
(
Either
SomeException
()
))
where
switchDir
=
getTemporaryDirectory
>>=
flip
createTempDirectory
"ihaskell-display-tmp"
>>=
setCurrentDirectory
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment