-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ fix ] missing modules in .ipkg files (#3124)
Additionally, we now have bash options to make sure we will fail hard were this situation to arise once again.
- Loading branch information
Showing
8 changed files
with
93 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
prefix="../../libs" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module Data.IOMatrix | ||
|
||
import Data.IOArray.Prims | ||
|
||
%default total | ||
|
||
export | ||
record IOMatrix a where | ||
constructor MkIOMatrix | ||
maxWidth : Int | ||
maxHeight : Int | ||
content : ArrayData (Maybe a) | ||
|
||
export | ||
width : IOMatrix a -> Int | ||
width = maxWidth | ||
|
||
export | ||
height : IOMatrix a -> Int | ||
height = maxHeight | ||
|
||
export | ||
new : HasIO io => (width, height : Int) -> io (IOMatrix a) | ||
new width height | ||
= pure $ MkIOMatrix width height | ||
!(primIO (prim__newArray (width * height) Nothing)) | ||
|
||
toPosition : IOMatrix a -> Int -> Int -> Maybe Int | ||
toPosition (MkIOMatrix w h arr) i j | ||
= do guard (not (i < 0 || j < 0 || i >= w || j >= h)) | ||
pure (i * h + j) | ||
|
||
export | ||
write : HasIO io => IOMatrix a -> Int -> Int -> a -> io Bool | ||
write mat i j el = case toPosition mat i j of | ||
Nothing => pure False | ||
Just pos => True <$ primIO (prim__arraySet (content mat) pos (Just el)) | ||
|
||
export | ||
read : HasIO io => IOMatrix a -> Int -> Int -> io (Maybe a) | ||
read mat i j = case toPosition mat i j of | ||
Nothing => pure Nothing | ||
Just pos => primIO (prim__arrayGet (content mat) pos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters