Skip to content

Commit

Permalink
use explicit export lists
Browse files Browse the repository at this point in the history
  • Loading branch information
patritzenfeld committed Jan 8, 2025
1 parent 9175e99 commit f1c37b5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 22 deletions.
4 changes: 3 additions & 1 deletion src/Compare.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{-# language RankNTypes #-}

module Compare (module Compare) where
module Compare (
runShare,
) where


import Data.Char (toLower)
Expand Down
16 changes: 16 additions & 0 deletions src/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module Examples (
example4,
example5,
threeCircles,

shareTest1,
shareTest2,
shareTest3,
) where


Expand Down Expand Up @@ -53,3 +57,15 @@ threeCircles :: Drawable a => a
threeCircles = colored red (solidCircle 1)
& translated 2 4 (colored green $ solidCircle 1)
& translated 0 3 (colored yellow $ solidCircle 1)


shareTest1 :: Drawable a => a
shareTest1 = circle 1 & translated 1 2 (circle 1)


shareTest2 :: Drawable a => a
shareTest2 = let c = circle 1 in c & translated 1 2 c


shareTest3 :: Drawable a => a
shareTest3 = let r = rectangle 2 3 in r & r
20 changes: 10 additions & 10 deletions src/HashCons.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{-# language MultiParamTypeClasses#-}
{-# language FlexibleContexts #-}

module HashCons (module HashCons) where
module HashCons (
Node(..),
NodeId,
BiMap,
getNodes,
hashconsShare,
) where


import Control.Monad.State (State, get, put, runState)
import Data.List (elemIndex)
import Data.Text (Text)

import API (Drawable(..))
import Types (Color, Font, NodeId, Point, TextStyle)
import Types (Color, Font, Point, TextStyle)



type NodeId = Int

data Node
= RectangleNode Double Double
| ThickRectangleNode Double Double Double
Expand Down Expand Up @@ -161,11 +169,3 @@ getNodes n = case n of
PicturesNode is -> is
AndNode i1 i2 -> [i1,i2]
_ -> []


test1 :: Drawable a => a
test1 = circle 1 & translated 1 2 (circle 1)


test2 :: Drawable a => a
test2 = let c = circle 1 in c & translated 1 2 c
2 changes: 1 addition & 1 deletion src/Normalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Data.List.Extra (sort)
import Data.Text (Text)

import API (Drawable(..))
import Types (Color(..), Point)
import Types (Color, Point)
import VectorSpace (
atOriginWithOffset,
isRectangle,
Expand Down
9 changes: 4 additions & 5 deletions src/Reify.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{-# language DeriveTraversable #-}
{-# language TypeFamilies #-}

module Reify (module Reify) where
module Reify (
ReifyPicture(..),
share,
) where


import Data.Foldable (toList)
Expand Down Expand Up @@ -147,7 +150,3 @@ share d = do

mapInsertWith :: [Key] -> IntMap Int -> IntMap Int
mapInsertWith b m = Prelude.foldr (\x acc-> IM.insertWith (+) x (1 :: Int) acc) m b


test :: Drawable a => a
test = let r = rectangle 2 3 in r & r
5 changes: 2 additions & 3 deletions src/Trie.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# options_ghc -Wno-orphans #-}

module Trie (
module Trie
shareGraph,
) where


Expand All @@ -16,8 +16,7 @@ import qualified Data.ByteString.Char8 as BS
import qualified Data.Trie as T

import API (Drawable(..))
import HashCons (Node(..), getNodes)
import Types (NodeId)
import HashCons (Node(..), NodeId, getNodes)



Expand Down
13 changes: 11 additions & 2 deletions src/Types.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@

module Types (
module Types
Point,
Vector,

Color,
TextStyle,
Font,

red,
green,
yellow,
) where


import Data.Text (Text)



type NodeId = Int
--type NodeId = Int
type Point = (Double,Double)
type Vector = (Double,Double)

Expand Down

0 comments on commit f1c37b5

Please sign in to comment.