Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
kharus committed Sep 11, 2024
1 parent fd5f988 commit 6d37861
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions src/AnyAll/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module AnyAll.Types(
PrePostRecord(..),
ShouldView(..),
AndOr(..),
StdinSchema(..),
ForD3(..),
mkQ,
qoutjs
) where
Expand Down Expand Up @@ -156,52 +154,4 @@ instance showAndOr :: (Show a) => Show (AndOr a) where
show = genericShow

instance encodeAndOr :: (Encode a) => Encode (AndOr a) where
encode eta = genericEncode defaultOptions eta

data StdinSchema a = StdinSchema
{ marking :: Marking
, andOrTree :: Item a
}

derive instance eqStdinSchema :: (Eq a) => Eq (StdinSchema a)
derive instance genericStdinSchema :: Generic (StdinSchema a) _
instance showStdinSchema :: (Show a) => Show (StdinSchema a) where
show = genericShow

instance encodeStdinSchema :: (Show a, Encode a) => Encode (StdinSchema a) where
encode eta = genericEncode defaultOptions eta

newtype ForD3 = ForD3
{ name :: String
, children :: Array ForD3
, value :: Int
}

derive instance eqForD3 :: Eq (ForD3)
derive instance genericForD3 :: Generic (ForD3) _
instance showForD3 :: Show (ForD3) where
show eta = genericShow eta

instance encodeForD3 :: Encode ForD3 where
encode eta = unsafeToForeign eta

forD3 :: String -> Q -> ForD3
forD3 lang (Q q) = ForD3
{ name: qName
, children: forD3 lang <$> q.children
, value: 100
}
where
qName = case q.andOr of
And -> maybe "all of" ( {- getNL <<< -} label2pre) q.prePost
Or -> maybe "any of" ( {- getNL <<< -} label2pre) q.prePost
(Simply x) -> shorten 45 $ getNL x
getNL x = case Map.lookup lang q.tagNL of
Nothing -> x
(Just t) -> x <> ". " <> t
shorten n x =
if DString.length x > n then DString.take (n - 3) x <> "..."
else x

d3_tag = JSON.writeJSON <<< encode <<< forD3 ""
d3_en = JSON.writeJSON <<< encode <<< forD3 "en"
encode eta = genericEncode defaultOptions eta

0 comments on commit 6d37861

Please sign in to comment.