matrix-as-xyz 0.1.2.1 → 0.1.2.2
raw patch · 9 files changed
+80/−27 lines, 9 filesdep ~matrixdep ~parsecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: matrix, parsec
API changes (from Hackage documentation)
Files
- ChangeLog.md +37/−0
- README.md +6/−0
- matrix-as-xyz.cabal +10/−13
- src/Data/Matrix/AsXYZ.hs +11/−11
- src/Data/Matrix/AsXYZ/Common.hs +1/−1
- src/Data/Matrix/AsXYZ/ParseXY.hs +1/−1
- src/Data/Matrix/AsXYZ/Plain.hs +1/−1
- test/AsXYSpec.hs +7/−0
- test/AsXYZSpec.hs +6/−0
+ ChangeLog.md view
@@ -0,0 +1,37 @@+# Revision history for matrix-as-xyz++## 0.1.2.2 -- 2020-08-09++* [jpn]依存関係の変更++## 0.1.2.1 -- 2020-08-07++* [jpn]ドキュメントのスペルミス修正++## 0.1.2.0 -- 2020-08-07++* [jpn]平面群向けのxy機能を追加++## 0.1.1.3 -- 2020-07-21++* [jpn]依存ライブラリのバージョンの修正等++## 0.1.1.2 -- 2020-07-21++* [jpn]依存ライブラリのバージョンの修正等++## 0.1.1.1 -- 2018-06-09++* [jpn]大文字が使用できなかった不具合の修正++## 0.1.1.0 -- 2018-06-05++* [jpn]CabalからStackに変更+* [jpn]API変更+* [jpn]挙動の変更+* [jpn]Documentの整備+* [jpn]その他色々++## 0.1.0.0 -- 2017-03-11++* First version. Released on an unsuspecting world.
README.md view
@@ -25,6 +25,12 @@ "x,y,z" ``` +If you wanna use newest version, edit stack.yaml like below.+```+extra-deps:+- location: https://github.com/narumij/matrix-as-xyz/archive/0.1.2.1.tar.gz+```+ ## License See the [LICENSE](https://raw.githubusercontent.com/narumij/matrix-as-xyz/master/LICENSE)
matrix-as-xyz.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 15ab1dd21ef40ddf3fc76de1c5032ebfbecff0ac440e58b84a9dcb82b66e6c9c+-- hash: 10f92c632c911988f6826ea7c85dd9a41eaf2c1971e1bf7314dac22823bf7744 name: matrix-as-xyz-version: 0.1.2.1+version: 0.1.2.2 synopsis: Read and Display Jones-Faithful notation for spacegroup and planegroup description: Please see the README on GitHub at <https://github.com/narumij/matrix-as-xyz#readme> category: Chemistry@@ -21,6 +21,7 @@ build-type: Simple extra-source-files: README.md+ ChangeLog.md source-repository head type: git@@ -41,10 +42,8 @@ src build-depends: base >=4.8 && <5- , doctest- , hspec- , matrix >=0.3.5 && <1- , parsec >=3.1 && <4+ , matrix >=0.1 && <0.4+ , parsec >=3 && <4 default-language: Haskell2010 test-suite doctest@@ -56,13 +55,12 @@ build-depends: base >=4.8 && <5 , doctest- , hspec- , matrix >=0.3.5 && <1+ , matrix >=0.1 && <0.4 , matrix-as-xyz- , parsec >=3.1 && <4+ , parsec >=3 && <4 default-language: Haskell2010 -test-suite spec-test+test-suite matrix-as-xyz-test type: exitcode-stdio-1.0 main-is: Spec.hs other-modules:@@ -76,9 +74,8 @@ build-depends: QuickCheck , base >=4.8 && <5- , doctest , hspec- , matrix >=0.3.5 && <1+ , matrix >=0.1 && <0.4 , matrix-as-xyz- , parsec >=3.1 && <4+ , parsec >=3 && <4 default-language: Haskell2010
src/Data/Matrix/AsXYZ.hs view
@@ -26,7 +26,7 @@ import Data.Char (isAlpha) import Data.List (intercalate) import Data.Ratio (Ratio,(%))-import Data.Matrix (Matrix,fromList,fromLists,toLists,identity,zero,(<->))+import Data.Matrix (Matrix,fromList,fromLists,toLists,identity,zero,(<->),submatrix) import Text.ParserCombinators.Parsec (parse,ParseError) import Data.Ratio.Slash (getRatio,Slash(..))@@ -52,11 +52,11 @@ -- > ( 9 10 11 12 ) -- > fromXYZ "x+2y+3z+4,5x+6y+7z+8,9x+10y+11z+12" :: Matrix Int = ( 0 0 0 1 ) fromXYZ :: Integral a => String -> Matrix (Ratio a)-fromXYZ input = unsafeGet $ makeMatrix <$> parse (XYZ.equivalentPositions XYZ.ratio) input input+fromXYZ input = unsafeGet $ makeMatrixS <$> parse (XYZ.equivalentPositions XYZ.ratio) input input -- | Maybe version fromXYZ' :: Integral a => String -> Maybe (Matrix (Ratio a))-fromXYZ' input = get $ makeMatrix <$> parse (XYZ.equivalentPositions XYZ.ratio) input input+fromXYZ' input = get $ makeMatrixS <$> parse (XYZ.equivalentPositions XYZ.ratio) input input -- | It's uses abc instead of xyz --@@ -65,10 +65,10 @@ -- > ( 0 % 1 0 % 1 1 % 1 0 % 1 ) -- > fromXYZ "a,b,c" :: Matrix Rational = ( 0 % 1 0 % 1 0 % 1 1 % 1 ) fromABC :: Integral a => String -> Matrix (Ratio a)-fromABC input = unsafeGet $ makeMatrix <$> parse (XYZ.transformPpABC XYZ.ratio) input input+fromABC input = unsafeGet $ makeMatrixS <$> parse (XYZ.transformPpABC XYZ.ratio) input input -makeMatrix :: Num a => [[a]] -> Matrix a-makeMatrix m = fromLists m <-> fromLists [[0,0,0,1]]+makeMatrixS :: Num a => [[a]] -> Matrix a+makeMatrixS m = (submatrix 1 3 1 4 . fromLists) m <-> fromLists [[0,0,0,1]] unsafeGet :: Either ParseError a -> a unsafeGet e = case e of@@ -113,7 +113,7 @@ fromXY :: Integral a => String -> Matrix (Ratio a)-fromXY input = unsafeGet $ makeMatrix' <$> parse (XY.equivalentPositions XY.ratio) input input+fromXY input = unsafeGet $ makeMatrixP <$> parse (XY.equivalentPositions XY.ratio) input input -- | Maybe version --@@ -123,7 +123,7 @@ fromXY' :: Integral a => String -> Maybe (Matrix (Ratio a))-fromXY' input = get $ makeMatrix' <$> parse (XY.equivalentPositions XY.ratio) input input+fromXY' input = get $ makeMatrixP <$> parse (XY.equivalentPositions XY.ratio) input input -- | It's uses abc instead of xyz --@@ -133,10 +133,10 @@ fromAB :: Integral a => String -> Matrix (Ratio a)-fromAB input = unsafeGet $ makeMatrix' <$> parse (XY.transformPpAB XY.ratio) input input+fromAB input = unsafeGet $ makeMatrixP <$> parse (XY.transformPpAB XY.ratio) input input -makeMatrix' :: Num a => [[a]] -> Matrix a-makeMatrix' m = fromLists m <-> fromLists [[0,0,1]]+makeMatrixP :: Num a => [[a]] -> Matrix a+makeMatrixP m = (submatrix 1 2 1 3 . fromLists) m <-> fromLists [[0,0,1]] -- | Get the xyz string of matrix --
src/Data/Matrix/AsXYZ/Common.hs view
@@ -1,6 +1,6 @@ {- | Module : Data.Matrix.AsXYZ.Common-Copyright : (c) Jun Narumi 2018-2020+Copyright : (c) Jun Narumi 2020 License : BSD3 Maintainer : narumij@gmail.com Stability : experimental
src/Data/Matrix/AsXYZ/ParseXY.hs view
@@ -1,6 +1,6 @@ {- | Module : Data.Matrix.AsXYZ.ParseXY-Copyright : (c) Jun Narumi 2020-2020+Copyright : (c) Jun Narumi 2020 License : BSD3 Maintainer : narumij@gmail.com Stability : experimental
src/Data/Matrix/AsXYZ/Plain.hs view
@@ -1,6 +1,6 @@ {- | Module : Data.Matrix.AsXYZ.ParseXYZ-Copyright : (c) Jun Narumi 2018-2020+Copyright : (c) Jun Narumi 2020 License : BSD3 Maintainer : narumij@gmail.com Stability : experimental
test/AsXYSpec.hs view
@@ -57,6 +57,13 @@ it "read A,B" $ do fromAB "A,B" `shouldBe` (identity 3) + it "row size" $ do+ (nrows . fromXY $ "x,y") `shouldBe` 3++ it "col size" $ do+ (ncols . fromXY $ "x,y") `shouldBe` 3++ describe "Data.Matrix.AsXYZ.prettyXYZ" $ do it "show 0 (2x2)" $ do
test/AsXYZSpec.hs view
@@ -88,6 +88,12 @@ it "read A,B,C" $ do fromABC "A,B,C" `shouldBe` (identity 4) + it "row size" $ do+ (nrows . fromXYZ $ "0,0,0") `shouldBe` 4++ it "col size" $ do+ (ncols . fromXYZ $ "0,0,0") `shouldBe` 4+ describe "Data.Matrix.AsXYZ.prettyXYZ" $ do it "show 0 (3x3)" $ do