Skip to content

Compiler 0.12 #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"name": "purescript-matrix",
"homepage": "https://github.com/jutaro/purescript-matrix",
"version": "0.2.0",
"authors": [
"Juergen Nicklisch-Franken <jnf@arcor.de>"
],
"version": "3.0.0",
"authors": ["Juergen Nicklisch-Franken <jnf@arcor.de>"],
"description": "Matrices for purescript",
"keywords": [
"purescript"
],
"keywords": ["purescript"],
"repository": {
"type": "git",
"url": "git://github.com/jutaro/purescript-matrix.git"
"url": "git://github.com/mgmeier/purescript-matrix.git"
},
"license": "Apache-2.0",
"ignore": [
Expand All @@ -26,17 +22,14 @@
"package.json"
],
"dependencies": {
"purescript-vector": "^2.0.0",
"purescript-arrays": "^4.2.0",
"purescript-extensions": "^2.2.0",
"purescript-proxy": "^2.1.0"
"purescript-vector": "AlexMouton/purescript-vector#compiler-0.12",
"purescript-arrays": "^5.0.0",
"purescript-proxy": "^3.0.0",
"purescript-effect": "2.0.0"
},
"devDependencies": {
"purescript-assert": "^3.0.0",
"purescript-console": "^3.0.0",
"purescript-random": "^3.0.0"
},
"resolutions": {
"purescript-extensions": "^2.2.0"
"purescript-assert": "^4.0.0",
"purescript-console": "^4.1.0",
"purescript-random": "^4.0.0"
}
}
24 changes: 12 additions & 12 deletions docs/Data/ST/Matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ newtype STMat s h a
#### `copyImpl`

``` purescript
copyImpl :: forall a b h r. a -> Eff (st :: ST h | r) b
copyImpl :: forall a b h. a -> Effect b
```

#### `freeze`

``` purescript
freeze :: forall a h r. STArray h a -> Eff (st :: ST h | r) (Array a)
freeze :: forall a h. STArray h a -> Effect (Array a)
```

Create an immutable copy of a mutable array.

#### `thaw`

``` purescript
thaw :: forall a h r. Array a -> Eff (st :: ST h | r) (STArray h a)
thaw :: forall a h. Array a -> Effect (STArray h a)
```

Create a mutable copy of an immutable array.
Expand All @@ -48,55 +48,55 @@ unsafeThaw :: forall a h. Array a -> STArray h a
#### `cloneSTMat`

``` purescript
cloneSTMat :: forall s h a r. (STMat s h a) -> Eff (st :: ST h | r) (STMat s h a)
cloneSTMat :: forall s h a. (STMat s h a) -> Effect (STMat s h a)
```

#### `fromSTMat`

``` purescript
fromSTMat :: forall s h a r. Sized s => (STMat s h a) -> Eff (st :: ST h | r) (Mat s a)
fromSTMat :: forall s h a. Sized s => (STMat s h a) -> Effect (Mat s a)
```

#### `toSTMat`

``` purescript
toSTMat :: forall s h a r. (Mat s a) -> Eff (st :: ST h | r) (STMat s h a)
toSTMat :: forall s h a. (Mat s a) -> Effect (STMat s h a)
```

#### `copyToSTMat`

``` purescript
copyToSTMat :: forall s h a r. (Mat s a) -> (STMat s h a) -> Eff (st :: ST h | r) Unit
copyToSTMat :: forall s h a. (Mat s a) -> (STMat s h a) -> Effect Unit
```

#### `identityST'`

``` purescript
identityST' :: forall s h r. Sized s => Eff (st :: ST h | r) (STMat s h Number)
identityST' :: forall s h. Sized s => Effect (STMat s h Number)
```

#### `scaleSTMatrixInt`

``` purescript
scaleSTMatrixInt :: forall a h r. EuclideanRing a => a -> STArray h a -> Eff (st :: ST h | r) Unit
scaleSTMatrixInt :: forall a h. EuclideanRing a => a -> STArray h a -> Effect Unit
```

#### `scaleSTMatrix`

``` purescript
scaleSTMatrix :: forall s a h r. EuclideanRing a => a -> (STMat s h a) -> Eff (st :: ST h | r) (STMat s h a)
scaleSTMatrix :: forall s a h. EuclideanRing a => a -> (STMat s h a) -> Effect (STMat s h a)
```

#### `fromMatrix`

``` purescript
fromMatrix :: forall s h r a. Mat s a -> Eff (st :: ST h | r) (STMat s h a)
fromMatrix :: forall s h a. Mat s a -> Effect (STMat s h a)
```

#### `runSTMatrix`

``` purescript
runSTMatrix :: forall s a r. (forall h. Eff (st :: ST h | r) (STMat s h a)) -> Eff r (Mat s a)
runSTMatrix :: forall s a. (forall h. Effect (STMat s h a)) -> Effect (Mat s a)
```


14 changes: 7 additions & 7 deletions docs/Data/ST/Matrix4.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@ type STMat4 h = STMat Four h Number
#### `identityST`

``` purescript
identityST :: forall h r. Eff (st :: ST h | r) (STMat Four h Number)
identityST :: forall h r. Effect (STMat Four h Number)
```

#### `rotateST`

``` purescript
rotateST :: forall h r. Number -> Vec3N -> STMat4 h -> Eff (st :: ST h | r) Unit
rotateST :: forall h r. Number -> Vec3N -> STMat4 h -> Effect Unit
```

#### `rotateSTX`

``` purescript
rotateSTX :: forall h r. Number -> STMat4 h -> Eff (st :: ST h | r) Unit
rotateSTX :: forall h r. Number -> STMat4 h -> Effect Unit
```

#### `rotateSTY`

``` purescript
rotateSTY :: forall h r. Number -> STMat4 h -> Eff (st :: ST h | r) Unit
rotateSTY :: forall h r. Number -> STMat4 h -> Effect Unit
```

#### `rotateSTZ`

``` purescript
rotateSTZ :: forall h r. Number -> STMat4 h -> Eff (st :: ST h | r) Unit
rotateSTZ :: forall h r. Number -> STMat4 h -> Effect Unit
```

#### `translateST`

``` purescript
translateST :: forall h r. Vec3N -> STMat4 h -> Eff (st :: ST h | r) Unit
translateST :: forall h r. Vec3N -> STMat4 h -> Effect Unit
```

#### `scaleST3`

``` purescript
scaleST3 :: forall h r. Number -> Number -> Number -> STMat4 h -> Eff (st :: ST h | r) Unit
scaleST3 :: forall h r. Number -> Number -> Number -> STMat4 h -> Effect Unit
```


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"devDependencies": {
"pulp": "^9.0.1",
"pulp": "^12.2.1",
"browserify": "*",
"benchmark": "*",
"microtime": "*"
Expand Down
7 changes: 3 additions & 4 deletions src/Data/Matrix.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import Data.Array (length, (!!), zipWith, slice, range, concat)
import Data.Maybe (fromJust)
import Data.TypeNat (class Sized, Four, Three, Two, sized)
import Type.Proxy (Proxy(Proxy))
import Extensions (fail)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial, unsafeCrashWith)

newtype Mat s a = Mat (Array a)

Expand Down Expand Up @@ -61,7 +60,7 @@ columns mat@(Mat m) | sized (Proxy :: Proxy s) == 2 =
slice 8 12 m,
slice 12 16 m]
| otherwise =
fail "Matrix>>columns: Proxy size not supprted!"
unsafeCrashWith "Matrix>>columns: Proxy size not supprted!"

instance eqMat :: (Eq a) => Eq (Mat s a) where
eq (Mat l) (Mat r) = l == r
Expand Down Expand Up @@ -107,7 +106,7 @@ fromArray l =
let size = sized (Proxy :: Proxy s)
in case size * size of
i | i == length l -> Mat l
| otherwise -> fail "Matrix>>fromArray: Wrong array length!"
| otherwise -> unsafeCrashWith "Matrix>>fromArray: Wrong array length!"

toArray :: forall s a. Mat s a -> Array a
toArray (Mat a) = a
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Matrix3.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Prelude ((*), (+), (-), ($), (/), (==))
import Data.TypeNat (Four, Three)
import Data.Matrix (Mat(Mat), fromArray)
import Data.Maybe (Maybe(Just, Nothing))
import Extensions (fail)
import Partial.Unsafe (unsafeCrashWith)

type Mat3 = Mat Three Number

Expand Down Expand Up @@ -63,4 +63,4 @@ normalFromMat4 (Mat [a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23,
(a31 * b05 - a32 * b04 + a33 * b03) * det,
(a32 * b02 - a30 * b05 - a33 * b01) * det,
(a30 * b04 - a31 * b02 + a33 * b00) * det]
normalFromMat4 _ = fail "Matrix4>>normalFromMat4: Impossible!"
normalFromMat4 _ = unsafeCrashWith "Matrix4>>normalFromMat4: Impossible!"
Loading