Skip to content

Commit

Permalink
Merge pull request #9 from 23prime/develop
Browse files Browse the repository at this point in the history
Release v1.0.9
  • Loading branch information
23prime authored Nov 7, 2024
2 parents b23c658 + 299a1a8 commit 61d8f06
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
plan:
- ghc: 9.4.8
resolver: lts-21.25
- ghc: 9.6.5
resolver: lts-22.25
- ghc: 9.6.6
resolver: lts-22.40
- ghc: 9.8.2
resolver: nightly
- ghc: latest
Expand Down
6 changes: 3 additions & 3 deletions oeis2.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: oeis2
version: 1.0.8
version: 1.0.9
synopsis: Interface for Online Encyclopedia of Integer Sequences (OEIS).
description: Release notes are here https://github.com/23prime/oeis2/releases
category: Math
Expand Down Expand Up @@ -36,7 +36,7 @@ library
build-depends:
aeson ==2.*
, base >=4.17 && <5
, containers >=0.5 && <0.7
, containers >=0.5 && <0.8
, http-conduit >=2.2 && <3
, lens >=4.15 && <6
, lens-aeson >=1.2 && <2
Expand All @@ -56,7 +56,7 @@ test-suite oeis2-test
QuickCheck
, aeson ==2.*
, base >=4.17 && <5
, containers >=0.5 && <0.7
, containers >=0.5 && <0.8
, hspec
, http-conduit >=2.2 && <3
, lens >=4.15 && <6
Expand Down
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: oeis2
version: 1.0.8
version: 1.0.9
github: "23prime/oeis2"
license: BSD3
author: "Taisuke Hikawa"
Expand All @@ -19,7 +19,7 @@ dependencies:
- text >= 2 && < 3
- vector >= 0.13 && < 0.14
- aeson >= 2 && < 3
- containers >= 0.5 && < 0.7
- containers >= 0.5 && < 0.8
- lens >= 4.15 && < 6
- lens-aeson >= 1.2 && < 2
- http-conduit >= 2.2 && < 3
Expand Down
7 changes: 4 additions & 3 deletions src/Math/OEIS/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

module Math.OEIS.Internal where

import Control.Lens ((^?), (^?!))
import Control.Lens ((^?!), (^?))
import Control.Monad (when)
import Data.Aeson.Lens
import Data.Aeson (decodeStrict)
import Data.Aeson.Key (fromText)
import Data.Aeson.Lens
import Data.Aeson.Types
import Data.Char
import Data.Functor
Expand Down Expand Up @@ -86,7 +87,7 @@ getResults :: SearchStatus -> Int -> Int -> V.Vector Value -> IO (V.Vector Value
getResults ss start bound vs = do
when (bound < 0) $ fail "Upper-bound number of search results mast be non-negative."
jsn <- getJSON ss start
let results' = jsn ^? key "results" . _Array
let results' = decodeStrict $ T.encodeUtf8 jsn :: Maybe Array
results = case results' of
Nothing -> return []
Just vs' ->
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-22.25
resolver: lts-22.40

packages:
- '.'
Expand Down
7 changes: 3 additions & 4 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ specLookupSeq = describe "Test for lookupSeq" $ do
maple <$> lookupSeq (ID "A000027") `shouldBe`
Just ["A000027 := n->n; seq(A000027(n), n=1..100);"]
it "No search results" $
lookupSeq (SubSeq [1,3,4,5,4,3,6]) `shouldBe` Nothing
lookupSeq (SubSeq [1,3,4,5,4,3,6,10000000]) `shouldBe` Nothing

specGetSeqData :: Spec
specGetSeqData = describe "Test for getSeqData" $ do
it "Get SeqData" $
getSeqData (ID "A000027")`shouldBe` Just [1..77]
it "No SeqData" $
getSeqData (SubSeq [1,3,4,5,4,3,6]) `shouldBe` Nothing
getSeqData (SubSeq [1,3,4,5,4,3,6,10000000]) `shouldBe` Nothing

specExtendSeq :: Spec
specExtendSeq = describe "Test for extendSeq" $ do
Expand All @@ -55,5 +55,4 @@ specExtendSeq = describe "Test for extendSeq" $ do
seq = extendSeq rs
in rs `isInfixOf` seq
it "No extension" $
extendSeq [1,3,4,5,4,3,6] `shouldBe` [1,3,4,5,4,3,6]

extendSeq [1,3,4,5,4,3,6,10000000] `shouldBe` [1,3,4,5,4,3,6,10000000]

0 comments on commit 61d8f06

Please sign in to comment.