From 4b4ddaf4174102339ca02bf47283b6e4fda2c8d3 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Sat, 11 Jan 2020 19:13:01 -0500 Subject: [PATCH] make related functions adjacent --- src/Grid.elm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Grid.elm b/src/Grid.elm index c484e17..7b7c3ba 100644 --- a/src/Grid.elm +++ b/src/Grid.elm @@ -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 @@ -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