Skip to content

Commit

Permalink
make related functions adjacent
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Jan 12, 2020
1 parent f53ac33 commit 4b4ddaf
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Grid.elm
Expand Up @@ -21,19 +21,6 @@ type FromRowsAndColumnsProblem
= MoreThanOneWidth (List Int)


{-| Construct a grid from a list of lists. The outer list is a list of rows,
and the inner lists are values in columns.
If the sizes of the column arrays (the inner ones) don't match up, you'll get a
`MoreThanOneWidth` error back from this function.
-}
fromRowsAndColumns : List (List a) -> Result FromRowsAndColumnsProblem (Grid a)
fromRowsAndColumns rowsAndColumns =
Array.fromList (List.map Array.fromList rowsAndColumns)
|> fromRowsAndColumnsArray


initialize : { rows : Int, columns : Int } -> ({ row : Int, column : Int } -> a) -> Grid a
initialize { rows, columns } init =
Grid
Expand Down Expand Up @@ -64,6 +51,19 @@ fromDimensions initter { rows, columns } =
}


{-| Construct a grid from a list of lists. The outer list is a list of rows,
and the inner lists are values in columns.
If the sizes of the column arrays (the inner ones) don't match up, you'll get a
`MoreThanOneWidth` error back from this function.
-}
fromRowsAndColumns : List (List a) -> Result FromRowsAndColumnsProblem (Grid a)
fromRowsAndColumns rowsAndColumns =
Array.fromList (List.map Array.fromList rowsAndColumns)
|> fromRowsAndColumnsArray


fromRowsAndColumnsArray : Array (Array a) -> Result FromRowsAndColumnsProblem (Grid a)
fromRowsAndColumnsArray rowsAndColumns =
let
Expand Down

0 comments on commit 4b4ddaf

Please sign in to comment.